home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / security / logdaemon-2.tar < prev    next >
Tape Archive  |  1993-03-31  |  248.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: Tape Archive (archive/tar).

You can browse this item here: logdaemon-2.tar

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file tar archive default
99% file tar archive (V7), file logdaemon-2/, mode 755 , uid 465 , gid 506 , size 0 , seconds 5356346640 default
98% file data default
100% lsar Tar default
100% gt2 TAR Archiv gefunden (Auflistung ist deaktiviert) default
100% disktype Pre-POSIX tar archive default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 6c 6f 67 64 61 65 6d 6f | 6e 2d 32 2f 00 00 00 00 |logdaemo|n-2/....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 37 | 35 35 20 00 20 20 20 34 |.... 7|55 . 4|
|00000070| 36 35 20 00 20 20 20 35 | 30 36 20 00 20 20 20 20 |65 . 5|06 . |
|00000080| 20 20 20 20 20 20 30 20 | 20 35 33 35 36 33 34 36 | 0 | 5356346|
|00000090| 36 34 30 20 20 20 36 31 | 37 31 00 20 00 00 00 00 |640 61|71. ....|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 6c 6f 67 64 61 65 6d 6f | 6e 2d 32 2f 72 73 68 64 |logdaemo|n-2/rshd|
|00000210| 2f 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |/.......|........|
|00000220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 20 20 20 37 | 35 35 20 00 20 20 20 34 |.... 7|55 . 4|
|00000270| 36 35 20 00 20 20 20 35 | 30 36 20 00 20 20 20 20 |65 . 5|06 . |
|00000280| 20 20 20 20 20 20 30 20 | 20 35 33 32 36 37 34 36 | 0 | 5326746|
|00000290| 37 36 33 20 20 20 37 31 | 34 30 00 20 00 00 00 00 |763 71|40. ....|
|000002a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 6c 6f 67 64 61 65 6d 6f | 6e 2d 32 2f 72 73 68 64 |logdaemo|n-2/rshd|
|00000410| 2f 72 73 68 64 2e 63 00 | 00 00 00 00 00 00 00 00 |/rshd.c.|........|
|00000420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000460| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 34 |.... 6|44 . 4|
|00000470| 36 35 20 00 20 20 20 35 | 30 36 20 00 20 20 20 20 |65 . 5|06 . |
|00000480| 20 20 32 35 32 31 30 20 | 20 35 33 32 36 37 34 35 | 25210 | 5326745|
|00000490| 34 32 36 20 20 31 30 33 | 34 34 00 20 00 00 00 00 |426 103|44. ....|
|000004a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000600| 2f 2a 0a 20 2a 20 43 6f | 70 79 72 69 67 68 74 20 |/*. * Co|pyright |
|00000610| 28 63 29 20 31 39 38 33 | 2c 20 31 39 38 38 20 54 |(c) 1983|, 1988 T|
|00000620| 68 65 20 52 65 67 65 6e | 74 73 20 6f 66 20 74 68 |he Regen|ts of th|
|00000630| 65 20 55 6e 69 76 65 72 | 73 69 74 79 20 6f 66 20 |e Univer|sity of |
|00000640| 43 61 6c 69 66 6f 72 6e | 69 61 2e 0a 20 2a 20 41 |Californ|ia.. * A|
|00000650| 6c 6c 20 72 69 67 68 74 | 73 20 72 65 73 65 72 76 |ll right|s reserv|
|00000660| 65 64 2e 0a 20 2a 0a 20 | 2a 20 52 65 64 69 73 74 |ed.. *. |* Redist|
|00000670| 72 69 62 75 74 69 6f 6e | 20 61 6e 64 20 75 73 65 |ribution| and use|
|00000680| 20 69 6e 20 73 6f 75 72 | 63 65 20 61 6e 64 20 62 | in sour|ce and b|
|00000690| 69 6e 61 72 79 20 66 6f | 72 6d 73 20 61 72 65 20 |inary fo|rms are |
|000006a0| 70 65 72 6d 69 74 74 65 | 64 0a 20 2a 20 70 72 6f |permitte|d. * pro|
|000006b0| 76 69 64 65 64 20 74 68 | 61 74 20 74 68 65 20 61 |vided th|at the a|
|000006c0| 62 6f 76 65 20 63 6f 70 | 79 72 69 67 68 74 20 6e |bove cop|yright n|
|000006d0| 6f 74 69 63 65 20 61 6e | 64 20 74 68 69 73 20 70 |otice an|d this p|
|000006e0| 61 72 61 67 72 61 70 68 | 20 61 72 65 0a 20 2a 20 |aragraph| are. * |
|000006f0| 64 75 70 6c 69 63 61 74 | 65 64 20 69 6e 20 61 6c |duplicat|ed in al|
|00000700| 6c 20 73 75 63 68 20 66 | 6f 72 6d 73 20 61 6e 64 |l such f|orms and|
|00000710| 20 74 68 61 74 20 61 6e | 79 20 64 6f 63 75 6d 65 | that an|y docume|
|00000720| 6e 74 61 74 69 6f 6e 2c | 0a 20 2a 20 61 64 76 65 |ntation,|. * adve|
|00000730| 72 74 69 73 69 6e 67 20 | 6d 61 74 65 72 69 61 6c |rtising |material|
|00000740| 73 2c 20 61 6e 64 20 6f | 74 68 65 72 20 6d 61 74 |s, and o|ther mat|
|00000750| 65 72 69 61 6c 73 20 72 | 65 6c 61 74 65 64 20 74 |erials r|elated t|
|00000760| 6f 20 73 75 63 68 0a 20 | 2a 20 64 69 73 74 72 69 |o such. |* distri|
|00000770| 62 75 74 69 6f 6e 20 61 | 6e 64 20 75 73 65 20 61 |bution a|nd use a|
|00000780| 63 6b 6e 6f 77 6c 65 64 | 67 65 20 74 68 61 74 20 |cknowled|ge that |
|00000790| 74 68 65 20 73 6f 66 74 | 77 61 72 65 20 77 61 73 |the soft|ware was|
|000007a0| 20 64 65 76 65 6c 6f 70 | 65 64 0a 20 2a 20 62 79 | develop|ed. * by|
|000007b0| 20 74 68 65 20 55 6e 69 | 76 65 72 73 69 74 79 20 | the Uni|versity |
|000007c0| 6f 66 20 43 61 6c 69 66 | 6f 72 6e 69 61 2c 20 42 |of Calif|ornia, B|
|000007d0| 65 72 6b 65 6c 65 79 2e | 20 20 54 68 65 20 6e 61 |erkeley.| The na|
|000007e0| 6d 65 20 6f 66 20 74 68 | 65 0a 20 2a 20 55 6e 69 |me of th|e. * Uni|
|000007f0| 76 65 72 73 69 74 79 20 | 6d 61 79 20 6e 6f 74 20 |versity |may not |
|00000800| 62 65 20 75 73 65 64 20 | 74 6f 20 65 6e 64 6f 72 |be used |to endor|
|00000810| 73 65 20 6f 72 20 70 72 | 6f 6d 6f 74 65 20 70 72 |se or pr|omote pr|
|00000820| 6f 64 75 63 74 73 20 64 | 65 72 69 76 65 64 0a 20 |oducts d|erived. |
|00000830| 2a 20 66 72 6f 6d 20 74 | 68 69 73 20 73 6f 66 74 |* from t|his soft|
|00000840| 77 61 72 65 20 77 69 74 | 68 6f 75 74 20 73 70 65 |ware wit|hout spe|
|00000850| 63 69 66 69 63 20 70 72 | 69 6f 72 20 77 72 69 74 |cific pr|ior writ|
|00000860| 74 65 6e 20 70 65 72 6d | 69 73 73 69 6f 6e 2e 0a |ten perm|ission..|
|00000870| 20 2a 20 54 48 49 53 20 | 53 4f 46 54 57 41 52 45 | * THIS |SOFTWARE|
|00000880| 20 49 53 20 50 52 4f 56 | 49 44 45 44 20 60 60 41 | IS PROV|IDED ``A|
|00000890| 53 20 49 53 27 27 20 41 | 4e 44 20 57 49 54 48 4f |S IS'' A|ND WITHO|
|000008a0| 55 54 20 41 4e 59 20 45 | 58 50 52 45 53 53 20 4f |UT ANY E|XPRESS O|
|000008b0| 52 0a 20 2a 20 49 4d 50 | 4c 49 45 44 20 57 41 52 |R. * IMP|LIED WAR|
|000008c0| 52 41 4e 54 49 45 53 2c | 20 49 4e 43 4c 55 44 49 |RANTIES,| INCLUDI|
|000008d0| 4e 47 2c 20 57 49 54 48 | 4f 55 54 20 4c 49 4d 49 |NG, WITH|OUT LIMI|
|000008e0| 54 41 54 49 4f 4e 2c 20 | 54 48 45 20 49 4d 50 4c |TATION, |THE IMPL|
|000008f0| 49 45 44 0a 20 2a 20 57 | 41 52 52 41 4e 54 49 45 |IED. * W|ARRANTIE|
|00000900| 53 20 4f 46 20 4d 45 52 | 43 48 41 4e 54 49 42 49 |S OF MER|CHANTIBI|
|00000910| 4c 49 54 59 20 41 4e 44 | 20 46 49 54 4e 45 53 53 |LITY AND| FITNESS|
|00000920| 20 46 4f 52 20 41 20 50 | 41 52 54 49 43 55 4c 41 | FOR A P|ARTICULA|
|00000930| 52 20 50 55 52 50 4f 53 | 45 2e 0a 20 2a 2f 0a 0a |R PURPOS|E.. */..|
|00000940| 23 69 66 6e 64 65 66 20 | 6c 69 6e 74 0a 63 68 61 |#ifndef |lint.cha|
|00000950| 72 20 63 6f 70 79 72 69 | 67 68 74 5b 5d 20 3d 0a |r copyri|ght[] =.|
|00000960| 22 40 28 23 29 20 43 6f | 70 79 72 69 67 68 74 20 |"@(#) Co|pyright |
|00000970| 28 63 29 20 31 39 38 33 | 2c 20 31 39 38 38 20 54 |(c) 1983|, 1988 T|
|00000980| 68 65 20 52 65 67 65 6e | 74 73 20 6f 66 20 74 68 |he Regen|ts of th|
|00000990| 65 20 55 6e 69 76 65 72 | 73 69 74 79 20 6f 66 20 |e Univer|sity of |
|000009a0| 43 61 6c 69 66 6f 72 6e | 69 61 2e 5c 6e 5c 0a 20 |Californ|ia.\n\. |
|000009b0| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|000009c0| 76 65 64 2e 5c 6e 22 3b | 0a 23 65 6e 64 69 66 20 |ved.\n";|.#endif |
|000009d0| 2f 2a 20 6e 6f 74 20 6c | 69 6e 74 20 2a 2f 0a 0a |/* not l|int */..|
|000009e0| 23 69 66 6e 64 65 66 20 | 6c 69 6e 74 0a 73 74 61 |#ifndef |lint.sta|
|000009f0| 74 69 63 20 63 68 61 72 | 20 73 63 63 73 69 64 5b |tic char| sccsid[|
|00000a00| 5d 20 3d 20 22 40 28 23 | 29 72 73 68 64 2e 63 09 |] = "@(#|)rshd.c.|
|00000a10| 35 2e 31 37 2e 31 2e 32 | 20 28 42 65 72 6b 65 6c |5.17.1.2| (Berkel|
|00000a20| 65 79 29 20 32 2f 37 2f | 38 39 22 3b 0a 23 65 6e |ey) 2/7/|89";.#en|
|00000a30| 64 69 66 20 2f 2a 20 6e | 6f 74 20 6c 69 6e 74 20 |dif /* n|ot lint |
|00000a40| 2a 2f 0a 0a 2f 2a 0a 20 | 2a 20 72 65 6d 6f 74 65 |*/../*. |* remote|
|00000a50| 20 73 68 65 6c 6c 20 73 | 65 72 76 65 72 3a 0a 20 | shell s|erver:. |
|00000a60| 2a 09 5b 70 6f 72 74 5d | 5c 30 0a 20 2a 09 72 65 |*.[port]|\0. *.re|
|00000a70| 6d 75 73 65 72 5c 30 0a | 20 2a 09 6c 6f 63 75 73 |muser\0.| *.locus|
|00000a80| 65 72 5c 30 0a 20 2a 09 | 63 6f 6d 6d 61 6e 64 5c |er\0. *.|command\|
|00000a90| 30 0a 20 2a 09 64 61 74 | 61 0a 20 2a 2f 0a 23 69 |0. *.dat|a. */.#i|
|00000aa0| 66 64 65 66 20 5f 5f 73 | 76 72 34 5f 5f 0a 23 69 |fdef __s|vr4__.#i|
|00000ab0| 6e 63 6c 75 64 65 20 3c | 75 6e 69 73 74 64 2e 68 |nclude <|unistd.h|
|00000ac0| 3e 09 2f 2a 20 66 6f 72 | 20 46 5f 4f 4b 20 2a 2f |>./* for| F_OK */|
|00000ad0| 0a 2f 2a 20 58 58 58 20 | 74 68 65 20 6e 65 78 74 |./* XXX |the next|
|00000ae0| 20 74 77 6f 20 73 68 6f | 75 6c 64 20 62 65 20 6b | two sho|uld be k|
|00000af0| 65 79 65 64 20 77 69 74 | 68 20 74 68 65 69 72 20 |eyed wit|h their |
|00000b00| 6f 77 6e 20 23 69 66 64 | 65 66 20 2a 2f 0a 23 64 |own #ifd|ef */.#d|
|00000b10| 65 66 69 6e 65 09 6b 69 | 6c 6c 70 67 28 70 2c 73 |efine.ki|llpg(p,s|
|00000b20| 29 09 6b 69 6c 6c 28 2d | 28 70 29 2c 28 73 29 29 |).kill(-|(p),(s))|
|00000b30| 0a 23 64 65 66 69 6e 65 | 09 73 65 74 70 67 72 70 |.#define|.setpgrp|
|00000b40| 28 78 2c 79 29 09 73 65 | 74 73 69 64 28 29 0a 23 |(x,y).se|tsid().#|
|00000b50| 64 65 66 69 6e 65 09 42 | 53 44 5f 43 4f 4d 50 09 |define.B|SD_COMP.|
|00000b60| 2f 2a 20 66 6f 72 20 73 | 79 73 2f 69 6f 63 74 6c |/* for s|ys/ioctl|
|00000b70| 2e 68 20 2a 2f 0a 23 65 | 6e 64 69 66 0a 0a 23 69 |.h */.#e|ndif..#i|
|00000b80| 66 64 65 66 20 55 53 45 | 5f 53 54 52 49 4e 47 5f |fdef USE|_STRING_|
|00000b90| 48 0a 23 64 65 66 69 6e | 65 09 69 6e 64 65 78 09 |H.#defin|e.index.|
|00000ba0| 09 73 74 72 63 68 72 0a | 23 64 65 66 69 6e 65 09 |.strchr.|#define.|
|00000bb0| 72 69 6e 64 65 78 09 09 | 73 74 72 72 63 68 72 0a |rindex..|strrchr.|
|00000bc0| 23 64 65 66 69 6e 65 09 | 62 63 6d 70 09 09 6d 65 |#define.|bcmp..me|
|00000bd0| 6d 63 6d 70 0a 23 65 6c | 73 65 0a 23 69 6e 63 6c |mcmp.#el|se.#incl|
|00000be0| 75 64 65 20 3c 73 74 72 | 69 6e 67 73 2e 68 3e 0a |ude <str|ings.h>.|
|00000bf0| 23 65 6e 64 69 66 0a 0a | 23 69 6e 63 6c 75 64 65 |#endif..|#include|
|00000c00| 20 3c 73 79 73 2f 70 61 | 72 61 6d 2e 68 3e 0a 23 | <sys/pa|ram.h>.#|
|00000c10| 69 6e 63 6c 75 64 65 20 | 3c 73 79 73 2f 69 6f 63 |include |<sys/ioc|
|00000c20| 74 6c 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |tl.h>.#i|nclude <|
|00000c30| 73 79 73 2f 73 6f 63 6b | 65 74 2e 68 3e 0a 23 69 |sys/sock|et.h>.#i|
|00000c40| 6e 63 6c 75 64 65 20 3c | 73 79 73 2f 66 69 6c 65 |nclude <|sys/file|
|00000c50| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |.h>.#inc|lude <sy|
|00000c60| 73 2f 74 69 6d 65 2e 68 | 3e 0a 0a 23 69 6e 63 6c |s/time.h|>..#incl|
|00000c70| 75 64 65 20 3c 6e 65 74 | 69 6e 65 74 2f 69 6e 2e |ude <net|inet/in.|
|00000c80| 68 3e 0a 0a 23 69 6e 63 | 6c 75 64 65 20 3c 61 72 |h>..#inc|lude <ar|
|00000c90| 70 61 2f 69 6e 65 74 2e | 68 3e 0a 0a 23 69 6e 63 |pa/inet.|h>..#inc|
|00000ca0| 6c 75 64 65 20 3c 73 74 | 64 69 6f 2e 68 3e 0a 23 |lude <st|dio.h>.#|
|00000cb0| 69 6e 63 6c 75 64 65 20 | 3c 65 72 72 6e 6f 2e 68 |include |<errno.h|
|00000cc0| 3e 0a 23 69 6e 63 6c 75 | 64 65 20 3c 70 77 64 2e |>.#inclu|de <pwd.|
|00000cd0| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 69 67 |h>.#incl|ude <sig|
|00000ce0| 6e 61 6c 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |nal.h>.#|include |
|00000cf0| 3c 6e 65 74 64 62 2e 68 | 3e 0a 23 69 6e 63 6c 75 |<netdb.h|>.#inclu|
|00000d00| 64 65 20 3c 73 79 73 6c | 6f 67 2e 68 3e 0a 0a 69 |de <sysl|og.h>..i|
|00000d10| 6e 74 09 65 72 72 6e 6f | 3b 0a 69 6e 74 09 6b 65 |nt.errno|;.int.ke|
|00000d20| 65 70 61 6c 69 76 65 20 | 3d 20 31 3b 0a 63 68 61 |epalive |= 1;.cha|
|00000d30| 72 09 2a 69 6e 64 65 78 | 28 29 2c 20 2a 72 69 6e |r.*index|(), *rin|
|00000d40| 64 65 78 28 29 2c 20 2a | 73 74 72 6e 63 61 74 28 |dex(), *|strncat(|
|00000d50| 29 3b 0a 2f 2a 56 41 52 | 41 52 47 53 31 2a 2f 0a |);./*VAR|ARGS1*/.|
|00000d60| 69 6e 74 09 65 72 72 6f | 72 28 29 3b 0a 0a 23 69 |int.erro|r();..#i|
|00000d70| 66 20 64 65 66 69 6e 65 | 64 28 73 75 6e 29 20 7c |f define|d(sun) ||
|00000d80| 7c 20 64 65 66 69 6e 65 | 64 28 75 6c 74 72 69 78 || define|d(ultrix|
|00000d90| 29 0a 69 6e 74 20 5f 63 | 68 65 63 6b 5f 72 68 6f |).int _c|heck_rho|
|00000da0| 73 74 73 5f 66 69 6c 65 | 3b 0a 23 65 6e 64 69 66 |sts_file|;.#endif|
|00000db0| 0a 0a 2f 2a 20 55 6c 74 | 72 69 78 20 73 79 73 6c |../* Ult|rix sysl|
|00000dc0| 6f 67 28 33 29 20 68 61 | 73 20 6e 6f 20 66 61 63 |og(3) ha|s no fac|
|00000dd0| 69 6c 69 74 79 20 6f 72 | 20 6f 70 74 69 6f 6e 73 |ility or| options|
|00000de0| 20 2a 2f 0a 23 69 66 6e | 64 65 66 20 4c 4f 47 5f | */.#ifn|def LOG_|
|00000df0| 44 41 45 4d 4f 4e 0a 23 | 64 65 66 69 6e 65 20 4c |DAEMON.#|define L|
|00000e00| 4f 47 5f 44 41 45 4d 4f | 4e 09 30 0a 23 64 65 66 |OG_DAEMO|N.0.#def|
|00000e10| 69 6e 65 20 4c 4f 47 5f | 4f 44 45 4c 41 59 09 30 |ine LOG_|ODELAY.0|
|00000e20| 0a 23 65 6e 64 69 66 0a | 0a 63 68 61 72 20 2a 70 |.#endif.|.char *p|
|00000e30| 72 6f 63 6e 61 6d 65 3b | 0a 0a 2f 2a 41 52 47 53 |rocname;|../*ARGS|
|00000e40| 55 53 45 44 2a 2f 0a 6d | 61 69 6e 28 61 72 67 63 |USED*/.m|ain(argc|
|00000e50| 2c 20 61 72 67 76 29 0a | 09 69 6e 74 20 61 72 67 |, argv).|.int arg|
|00000e60| 63 3b 0a 09 63 68 61 72 | 20 2a 2a 61 72 67 76 3b |c;..char| **argv;|
|00000e70| 0a 7b 0a 09 65 78 74 65 | 72 6e 20 69 6e 74 20 6f |.{..exte|rn int o|
|00000e80| 70 74 65 72 72 2c 20 6f | 70 74 69 6e 64 2c 20 5f |pterr, o|ptind, _|
|00000e90| 63 68 65 63 6b 5f 72 68 | 6f 73 74 73 5f 66 69 6c |check_rh|osts_fil|
|00000ea0| 65 3b 0a 09 73 74 72 75 | 63 74 20 6c 69 6e 67 65 |e;..stru|ct linge|
|00000eb0| 72 20 6c 69 6e 67 65 72 | 3b 0a 09 69 6e 74 20 63 |r linger|;..int c|
|00000ec0| 68 2c 20 6f 6e 20 3d 20 | 31 2c 20 66 72 6f 6d 6c |h, on = |1, froml|
|00000ed0| 65 6e 3b 0a 09 73 74 72 | 75 63 74 20 73 6f 63 6b |en;..str|uct sock|
|00000ee0| 61 64 64 72 5f 69 6e 20 | 66 72 6f 6d 3b 0a 0a 09 |addr_in |from;...|
|00000ef0| 75 6d 61 73 6b 28 30 32 | 32 29 3b 0a 0a 09 70 72 |umask(02|2);...pr|
|00000f00| 6f 63 6e 61 6d 65 20 3d | 20 61 72 67 76 5b 30 5d |ocname =| argv[0]|
|00000f10| 3b 0a 0a 09 6f 70 65 6e | 6c 6f 67 28 70 72 6f 63 |;...open|log(proc|
|00000f20| 6e 61 6d 65 2c 20 4c 4f | 47 5f 50 49 44 20 7c 20 |name, LO|G_PID | |
|00000f30| 4c 4f 47 5f 4f 44 45 4c | 41 59 2c 20 4c 4f 47 5f |LOG_ODEL|AY, LOG_|
|00000f40| 44 41 45 4d 4f 4e 29 3b | 0a 0a 09 6f 70 74 65 72 |DAEMON);|...opter|
|00000f50| 72 20 3d 20 30 3b 0a 09 | 77 68 69 6c 65 20 28 28 |r = 0;..|while ((|
|00000f60| 63 68 20 3d 20 67 65 74 | 6f 70 74 28 61 72 67 63 |ch = get|opt(argc|
|00000f70| 2c 20 61 72 67 76 2c 20 | 22 6c 6e 22 29 29 20 21 |, argv, |"ln")) !|
|00000f80| 3d 20 45 4f 46 29 0a 09 | 09 73 77 69 74 63 68 28 |= EOF)..|.switch(|
|00000f90| 28 63 68 61 72 29 63 68 | 29 20 7b 0a 09 09 63 61 |(char)ch|) {...ca|
|00000fa0| 73 65 20 27 6c 27 3a 0a | 09 09 09 5f 63 68 65 63 |se 'l':.|..._chec|
|00000fb0| 6b 5f 72 68 6f 73 74 73 | 5f 66 69 6c 65 20 3d 20 |k_rhosts|_file = |
|00000fc0| 30 3b 0a 09 09 09 62 72 | 65 61 6b 3b 0a 09 09 63 |0;....br|eak;...c|
|00000fd0| 61 73 65 20 27 6e 27 3a | 0a 09 09 09 6b 65 65 70 |ase 'n':|....keep|
|00000fe0| 61 6c 69 76 65 20 3d 20 | 30 3b 0a 09 09 09 62 72 |alive = |0;....br|
|00000ff0| 65 61 6b 3b 0a 09 09 63 | 61 73 65 20 27 3f 27 3a |eak;...c|ase '?':|
|00001000| 0a 09 09 64 65 66 61 75 | 6c 74 3a 0a 09 09 09 73 |...defau|lt:....s|
|00001010| 79 73 6c 6f 67 28 4c 4f | 47 5f 45 52 52 2c 20 22 |yslog(LO|G_ERR, "|
|00001020| 75 73 61 67 65 3a 20 72 | 73 68 64 20 5b 2d 6c 5d |usage: r|shd [-l]|
|00001030| 22 29 3b 0a 09 09 09 62 | 72 65 61 6b 3b 0a 09 09 |");....b|reak;...|
|00001040| 7d 0a 0a 09 61 72 67 63 | 20 2d 3d 20 6f 70 74 69 |}...argc| -= opti|
|00001050| 6e 64 3b 0a 09 61 72 67 | 76 20 2b 3d 20 6f 70 74 |nd;..arg|v += opt|
|00001060| 69 6e 64 3b 0a 0a 0a 09 | 66 72 6f 6d 6c 65 6e 20 |ind;....|fromlen |
|00001070| 3d 20 73 69 7a 65 6f 66 | 20 28 66 72 6f 6d 29 3b |= sizeof| (from);|
|00001080| 0a 09 69 66 20 28 67 65 | 74 70 65 65 72 6e 61 6d |..if (ge|tpeernam|
|00001090| 65 28 30 2c 20 26 66 72 | 6f 6d 2c 20 26 66 72 6f |e(0, &fr|om, &fro|
|000010a0| 6d 6c 65 6e 29 20 3c 20 | 30 29 20 7b 0a 09 09 66 |mlen) < |0) {...f|
|000010b0| 70 72 69 6e 74 66 28 73 | 74 64 65 72 72 2c 20 22 |printf(s|tderr, "|
|000010c0| 25 73 3a 20 22 2c 20 61 | 72 67 76 5b 30 5d 29 3b |%s: ", a|rgv[0]);|
|000010d0| 0a 09 09 70 65 72 72 6f | 72 28 22 67 65 74 70 65 |...perro|r("getpe|
|000010e0| 65 72 6e 61 6d 65 22 29 | 3b 0a 09 09 5f 65 78 69 |ername")|;..._exi|
|000010f0| 74 28 31 29 3b 0a 09 7d | 0a 09 69 66 20 28 6b 65 |t(1);..}|..if (ke|
|00001100| 65 70 61 6c 69 76 65 20 | 26 26 0a 09 20 20 20 20 |epalive |&&.. |
|00001110| 73 65 74 73 6f 63 6b 6f | 70 74 28 30 2c 20 53 4f |setsocko|pt(0, SO|
|00001120| 4c 5f 53 4f 43 4b 45 54 | 2c 20 53 4f 5f 4b 45 45 |L_SOCKET|, SO_KEE|
|00001130| 50 41 4c 49 56 45 2c 20 | 28 63 68 61 72 20 2a 29 |PALIVE, |(char *)|
|00001140| 26 6f 6e 2c 0a 09 20 20 | 20 20 73 69 7a 65 6f 66 |&on,.. | sizeof|
|00001150| 28 6f 6e 29 29 20 3c 20 | 30 29 0a 09 09 73 79 73 |(on)) < |0)...sys|
|00001160| 6c 6f 67 28 4c 4f 47 5f | 57 41 52 4e 49 4e 47 2c |log(LOG_|WARNING,|
|00001170| 20 22 73 65 74 73 6f 63 | 6b 6f 70 74 20 28 53 4f | "setsoc|kopt (SO|
|00001180| 5f 4b 45 45 50 41 4c 49 | 56 45 29 3a 20 25 6d 22 |_KEEPALI|VE): %m"|
|00001190| 29 3b 0a 09 6c 69 6e 67 | 65 72 2e 6c 5f 6f 6e 6f |);..ling|er.l_ono|
|000011a0| 66 66 20 3d 20 31 3b 0a | 09 6c 69 6e 67 65 72 2e |ff = 1;.|.linger.|
|000011b0| 6c 5f 6c 69 6e 67 65 72 | 20 3d 20 36 30 3b 09 09 |l_linger| = 60;..|
|000011c0| 09 2f 2a 20 58 58 58 20 | 2a 2f 0a 09 69 66 20 28 |./* XXX |*/..if (|
|000011d0| 73 65 74 73 6f 63 6b 6f | 70 74 28 30 2c 20 53 4f |setsocko|pt(0, SO|
|000011e0| 4c 5f 53 4f 43 4b 45 54 | 2c 20 53 4f 5f 4c 49 4e |L_SOCKET|, SO_LIN|
|000011f0| 47 45 52 2c 20 28 63 68 | 61 72 20 2a 29 26 6c 69 |GER, (ch|ar *)&li|
|00001200| 6e 67 65 72 2c 0a 09 20 | 20 20 20 73 69 7a 65 6f |nger,.. | sizeo|
|00001210| 66 20 28 6c 69 6e 67 65 | 72 29 29 20 3c 20 30 29 |f (linge|r)) < 0)|
|00001220| 0a 09 09 73 79 73 6c 6f | 67 28 4c 4f 47 5f 57 41 |...syslo|g(LOG_WA|
|00001230| 52 4e 49 4e 47 2c 20 22 | 73 65 74 73 6f 63 6b 6f |RNING, "|setsocko|
|00001240| 70 74 20 28 53 4f 5f 4c | 49 4e 47 45 52 29 3a 20 |pt (SO_L|INGER): |
|00001250| 25 6d 22 29 3b 0a 09 64 | 6f 69 74 28 26 66 72 6f |%m");..d|oit(&fro|
|00001260| 6d 29 3b 0a 7d 0a 0a 63 | 68 61 72 09 75 73 65 72 |m);.}..c|har.user|
|00001270| 6e 61 6d 65 5b 32 30 5d | 20 3d 20 22 55 53 45 52 |name[20]| = "USER|
|00001280| 3d 22 3b 0a 63 68 61 72 | 09 68 6f 6d 65 64 69 72 |=";.char|.homedir|
|00001290| 5b 36 34 5d 20 3d 20 22 | 48 4f 4d 45 3d 22 3b 0a |[64] = "|HOME=";.|
|000012a0| 63 68 61 72 09 73 68 65 | 6c 6c 5b 36 34 5d 20 3d |char.she|ll[64] =|
|000012b0| 20 22 53 48 45 4c 4c 3d | 22 3b 0a 63 68 61 72 09 | "SHELL=|";.char.|
|000012c0| 2a 65 6e 76 69 6e 69 74 | 5b 5d 20 3d 0a 23 69 66 |*envinit|[] =.#if|
|000012d0| 64 65 66 20 5f 5f 73 76 | 72 34 5f 5f 0a 09 20 20 |def __sv|r4__.. |
|000012e0| 20 20 7b 68 6f 6d 65 64 | 69 72 2c 20 73 68 65 6c | {homed|ir, shel|
|000012f0| 6c 2c 20 22 50 41 54 48 | 3d 2f 75 73 72 2f 62 69 |l, "PATH|=/usr/bi|
|00001300| 6e 3a 22 2c 20 75 73 65 | 72 6e 61 6d 65 2c 20 30 |n:", use|rname, 0|
|00001310| 7d 3b 0a 23 65 6c 73 65 | 0a 09 20 20 20 20 7b 68 |};.#else|.. {h|
|00001320| 6f 6d 65 64 69 72 2c 20 | 73 68 65 6c 6c 2c 20 22 |omedir, |shell, "|
|00001330| 50 41 54 48 3d 2f 75 73 | 72 2f 75 63 62 3a 2f 62 |PATH=/us|r/ucb:/b|
|00001340| 69 6e 3a 2f 75 73 72 2f | 62 69 6e 3a 22 2c 20 75 |in:/usr/|bin:", u|
|00001350| 73 65 72 6e 61 6d 65 2c | 20 30 7d 3b 0a 23 65 6e |sername,| 0};.#en|
|00001360| 64 69 66 0a 63 68 61 72 | 09 2a 2a 65 6e 76 69 72 |dif.char|.**envir|
|00001370| 6f 6e 3b 0a 0a 64 6f 69 | 74 28 66 72 6f 6d 70 29 |on;..doi|t(fromp)|
|00001380| 0a 09 73 74 72 75 63 74 | 20 73 6f 63 6b 61 64 64 |..struct| sockadd|
|00001390| 72 5f 69 6e 20 2a 66 72 | 6f 6d 70 3b 0a 7b 0a 09 |r_in *fr|omp;.{..|
|000013a0| 63 68 61 72 20 63 6d 64 | 62 75 66 5b 4e 43 41 52 |char cmd|buf[NCAR|
|000013b0| 47 53 2b 31 5d 2c 20 2a | 63 70 3b 0a 09 63 68 61 |GS+1], *|cp;..cha|
|000013c0| 72 20 6c 6f 63 75 73 65 | 72 5b 31 36 5d 2c 20 72 |r locuse|r[16], r|
|000013d0| 65 6d 75 73 65 72 5b 31 | 36 5d 3b 0a 09 73 74 72 |emuser[1|6];..str|
|000013e0| 75 63 74 20 70 61 73 73 | 77 64 20 2a 70 77 64 3b |uct pass|wd *pwd;|
|000013f0| 0a 09 69 6e 74 20 73 3b | 0a 09 73 74 72 75 63 74 |..int s;|..struct|
|00001400| 20 68 6f 73 74 65 6e 74 | 20 2a 68 70 3b 0a 09 63 | hostent| *hp;..c|
|00001410| 68 61 72 20 2a 68 6f 73 | 74 6e 61 6d 65 3b 0a 09 |har *hos|tname;..|
|00001420| 73 68 6f 72 74 20 70 6f | 72 74 3b 0a 09 69 6e 74 |short po|rt;..int|
|00001430| 20 70 76 5b 32 5d 2c 20 | 70 69 64 2c 20 63 63 3b | pv[2], |pid, cc;|
|00001440| 0a 09 69 6e 74 20 6e 66 | 64 3b 0a 09 66 64 5f 73 |..int nf|d;..fd_s|
|00001450| 65 74 20 72 65 61 64 79 | 2c 20 72 65 61 64 66 72 |et ready|, readfr|
|00001460| 6f 6d 3b 0a 09 63 68 61 | 72 20 62 75 66 5b 42 55 |om;..cha|r buf[BU|
|00001470| 46 53 49 5a 5d 2c 20 73 | 69 67 3b 0a 09 69 6e 74 |FSIZ], s|ig;..int|
|00001480| 20 6f 6e 65 20 3d 20 31 | 3b 0a 09 63 68 61 72 20 | one = 1|;..char |
|00001490| 72 65 6d 6f 74 65 68 6f | 73 74 5b 32 20 2a 20 4d |remoteho|st[2 * M|
|000014a0| 41 58 48 4f 53 54 4e 41 | 4d 45 4c 45 4e 20 2b 20 |AXHOSTNA|MELEN + |
|000014b0| 31 5d 3b 0a 0a 09 28 76 | 6f 69 64 29 20 73 69 67 |1];...(v|oid) sig|
|000014c0| 6e 61 6c 28 53 49 47 49 | 4e 54 2c 20 53 49 47 5f |nal(SIGI|NT, SIG_|
|000014d0| 44 46 4c 29 3b 0a 09 28 | 76 6f 69 64 29 20 73 69 |DFL);..(|void) si|
|000014e0| 67 6e 61 6c 28 53 49 47 | 51 55 49 54 2c 20 53 49 |gnal(SIG|QUIT, SI|
|000014f0| 47 5f 44 46 4c 29 3b 0a | 09 28 76 6f 69 64 29 20 |G_DFL);.|.(void) |
|00001500| 73 69 67 6e 61 6c 28 53 | 49 47 54 45 52 4d 2c 20 |signal(S|IGTERM, |
|00001510| 53 49 47 5f 44 46 4c 29 | 3b 0a 23 69 66 64 65 66 |SIG_DFL)|;.#ifdef|
|00001520| 20 44 45 42 55 47 0a 09 | 7b 20 69 6e 74 20 74 20 | DEBUG..|{ int t |
|00001530| 3d 20 6f 70 65 6e 28 22 | 2f 64 65 76 2f 74 74 79 |= open("|/dev/tty|
|00001540| 22 2c 20 32 29 3b 0a 09 | 20 20 69 66 20 28 74 20 |", 2);..| if (t |
|00001550| 3e 3d 20 30 29 20 7b 0a | 09 09 69 6f 63 74 6c 28 |>= 0) {.|..ioctl(|
|00001560| 74 2c 20 54 49 4f 43 4e | 4f 54 54 59 2c 20 28 63 |t, TIOCN|OTTY, (c|
|00001570| 68 61 72 20 2a 29 30 29 | 3b 0a 09 09 28 76 6f 69 |har *)0)|;...(voi|
|00001580| 64 29 20 63 6c 6f 73 65 | 28 74 29 3b 0a 09 20 20 |d) close|(t);.. |
|00001590| 7d 0a 09 7d 0a 23 65 6e | 64 69 66 0a 09 66 72 6f |}..}.#en|dif..fro|
|000015a0| 6d 70 2d 3e 73 69 6e 5f | 70 6f 72 74 20 3d 20 6e |mp->sin_|port = n|
|000015b0| 74 6f 68 73 28 28 75 5f | 73 68 6f 72 74 29 66 72 |tohs((u_|short)fr|
|000015c0| 6f 6d 70 2d 3e 73 69 6e | 5f 70 6f 72 74 29 3b 0a |omp->sin|_port);.|
|000015d0| 09 69 66 20 28 66 72 6f | 6d 70 2d 3e 73 69 6e 5f |.if (fro|mp->sin_|
|000015e0| 66 61 6d 69 6c 79 20 21 | 3d 20 41 46 5f 49 4e 45 |family !|= AF_INE|
|000015f0| 54 29 20 7b 0a 09 09 73 | 79 73 6c 6f 67 28 4c 4f |T) {...s|yslog(LO|
|00001600| 47 5f 45 52 52 2c 20 22 | 6d 61 6c 66 6f 72 6d 65 |G_ERR, "|malforme|
|00001610| 64 20 66 72 6f 6d 20 61 | 64 64 72 65 73 73 5c 6e |d from a|ddress\n|
|00001620| 22 29 3b 0a 09 09 65 78 | 69 74 28 31 29 3b 0a 09 |");...ex|it(1);..|
|00001630| 7d 0a 23 69 66 64 65 66 | 20 49 50 5f 4f 50 54 49 |}.#ifdef| IP_OPTI|
|00001640| 4f 4e 53 0a 20 20 20 20 | 20 20 7b 0a 09 75 5f 63 |ONS. | {..u_c|
|00001650| 68 61 72 20 6f 70 74 62 | 75 66 5b 42 55 46 53 49 |har optb|uf[BUFSI|
|00001660| 5a 2f 33 5d 2c 20 2a 63 | 70 3b 0a 09 63 68 61 72 |Z/3], *c|p;..char|
|00001670| 20 6c 62 75 66 5b 42 55 | 46 53 49 5a 5d 2c 20 2a | lbuf[BU|FSIZ], *|
|00001680| 6c 70 3b 0a 09 69 6e 74 | 20 6f 70 74 73 69 7a 65 |lp;..int| optsize|
|00001690| 20 3d 20 73 69 7a 65 6f | 66 28 6f 70 74 62 75 66 | = sizeo|f(optbuf|
|000016a0| 29 2c 20 69 70 70 72 6f | 74 6f 3b 0a 09 73 74 72 |), ippro|to;..str|
|000016b0| 75 63 74 20 70 72 6f 74 | 6f 65 6e 74 20 2a 69 70 |uct prot|oent *ip|
|000016c0| 3b 0a 0a 09 69 66 20 28 | 28 69 70 20 3d 20 67 65 |;...if (|(ip = ge|
|000016d0| 74 70 72 6f 74 6f 62 79 | 6e 61 6d 65 28 22 69 70 |tprotoby|name("ip|
|000016e0| 22 29 29 20 21 3d 20 4e | 55 4c 4c 29 0a 09 09 69 |")) != N|ULL)...i|
|000016f0| 70 70 72 6f 74 6f 20 3d | 20 69 70 2d 3e 70 5f 70 |pproto =| ip->p_p|
|00001700| 72 6f 74 6f 3b 0a 09 65 | 6c 73 65 0a 09 09 69 70 |roto;..e|lse...ip|
|00001710| 70 72 6f 74 6f 20 3d 20 | 49 50 50 52 4f 54 4f 5f |proto = |IPPROTO_|
|00001720| 49 50 3b 0a 09 69 66 20 | 28 67 65 74 73 6f 63 6b |IP;..if |(getsock|
|00001730| 6f 70 74 28 30 2c 20 69 | 70 70 72 6f 74 6f 2c 20 |opt(0, i|pproto, |
|00001740| 49 50 5f 4f 50 54 49 4f | 4e 53 2c 20 28 63 68 61 |IP_OPTIO|NS, (cha|
|00001750| 72 20 2a 29 6f 70 74 62 | 75 66 2c 20 26 6f 70 74 |r *)optb|uf, &opt|
|00001760| 73 69 7a 65 29 20 3d 3d | 20 30 20 26 26 0a 09 20 |size) ==| 0 &&.. |
|00001770| 20 20 20 6f 70 74 73 69 | 7a 65 20 21 3d 20 30 29 | optsi|ze != 0)|
|00001780| 20 7b 0a 09 09 6c 70 20 | 3d 20 6c 62 75 66 3b 0a | {...lp |= lbuf;.|
|00001790| 09 09 66 6f 72 20 28 63 | 70 20 3d 20 6f 70 74 62 |..for (c|p = optb|
|000017a0| 75 66 3b 20 6f 70 74 73 | 69 7a 65 20 3e 20 30 3b |uf; opts|ize > 0;|
|000017b0| 20 63 70 2b 2b 2c 20 6f | 70 74 73 69 7a 65 2d 2d | cp++, o|ptsize--|
|000017c0| 2c 20 6c 70 20 2b 3d 20 | 33 29 0a 09 09 09 73 70 |, lp += |3)....sp|
|000017d0| 72 69 6e 74 66 28 6c 70 | 2c 20 22 20 25 32 2e 32 |rintf(lp|, " %2.2|
|000017e0| 78 22 2c 20 2a 63 70 29 | 3b 0a 09 09 73 79 73 6c |x", *cp)|;...sysl|
|000017f0| 6f 67 28 4c 4f 47 5f 4e | 4f 54 49 43 45 2c 0a 09 |og(LOG_N|OTICE,..|
|00001800| 09 20 20 20 20 22 43 6f | 6e 6e 65 63 74 69 6f 6e |. "Co|nnection|
|00001810| 20 72 65 63 65 69 76 65 | 64 20 75 73 69 6e 67 20 | receive|d using |
|00001820| 49 50 20 6f 70 74 69 6f | 6e 73 20 28 69 67 6e 6f |IP optio|ns (igno|
|00001830| 72 65 64 29 3a 25 73 22 | 2c 20 6c 62 75 66 29 3b |red):%s"|, lbuf);|
|00001840| 0a 09 09 69 66 20 28 73 | 65 74 73 6f 63 6b 6f 70 |...if (s|etsockop|
|00001850| 74 28 30 2c 20 69 70 70 | 72 6f 74 6f 2c 20 49 50 |t(0, ipp|roto, IP|
|00001860| 5f 4f 50 54 49 4f 4e 53 | 2c 0a 09 09 20 20 20 20 |_OPTIONS|,... |
|00001870| 28 63 68 61 72 20 2a 29 | 4e 55 4c 4c 2c 20 6f 70 |(char *)|NULL, op|
|00001880| 74 73 69 7a 65 29 20 21 | 3d 20 30 29 20 7b 0a 09 |tsize) !|= 0) {..|
|00001890| 09 09 73 79 73 6c 6f 67 | 28 4c 4f 47 5f 45 52 52 |..syslog|(LOG_ERR|
|000018a0| 2c 20 22 73 65 74 73 6f | 63 6b 6f 70 74 20 49 50 |, "setso|ckopt IP|
|000018b0| 5f 4f 50 54 49 4f 4e 53 | 20 4e 55 4c 4c 3a 20 25 |_OPTIONS| NULL: %|
|000018c0| 6d 22 29 3b 0a 09 09 09 | 65 78 69 74 28 31 29 3b |m");....|exit(1);|
|000018d0| 0a 09 09 7d 0a 09 7d 0a | 20 20 20 20 20 20 7d 0a |...}..}.| }.|
|000018e0| 23 65 6e 64 69 66 0a 0a | 09 69 66 20 28 66 72 6f |#endif..|.if (fro|
|000018f0| 6d 70 2d 3e 73 69 6e 5f | 70 6f 72 74 20 3e 3d 20 |mp->sin_|port >= |
|00001900| 49 50 50 4f 52 54 5f 52 | 45 53 45 52 56 45 44 20 |IPPORT_R|ESERVED |
|00001910| 7c 7c 0a 09 20 20 20 20 | 66 72 6f 6d 70 2d 3e 73 |||.. |fromp->s|
|00001920| 69 6e 5f 70 6f 72 74 20 | 3c 20 49 50 50 4f 52 54 |in_port |< IPPORT|
|00001930| 5f 52 45 53 45 52 56 45 | 44 2f 32 29 20 7b 0a 09 |_RESERVE|D/2) {..|
|00001940| 09 73 79 73 6c 6f 67 28 | 4c 4f 47 5f 4e 4f 54 49 |.syslog(|LOG_NOTI|
|00001950| 43 45 2c 20 22 43 6f 6e | 6e 65 63 74 69 6f 6e 20 |CE, "Con|nection |
|00001960| 66 72 6f 6d 20 25 73 20 | 6f 6e 20 69 6c 6c 65 67 |from %s |on illeg|
|00001970| 61 6c 20 70 6f 72 74 22 | 2c 0a 09 09 09 69 6e 65 |al port"|,....ine|
|00001980| 74 5f 6e 74 6f 61 28 66 | 72 6f 6d 70 2d 3e 73 69 |t_ntoa(f|romp->si|
|00001990| 6e 5f 61 64 64 72 29 29 | 3b 0a 09 09 65 78 69 74 |n_addr))|;...exit|
|000019a0| 28 31 29 3b 0a 09 7d 0a | 0a 09 28 76 6f 69 64 29 |(1);..}.|..(void)|
|000019b0| 20 61 6c 61 72 6d 28 36 | 30 29 3b 0a 09 70 6f 72 | alarm(6|0);..por|
|000019c0| 74 20 3d 20 30 3b 0a 09 | 66 6f 72 20 28 3b 3b 29 |t = 0;..|for (;;)|
|000019d0| 20 7b 0a 09 09 63 68 61 | 72 20 63 3b 0a 09 09 69 | {...cha|r c;...i|
|000019e0| 66 20 28 28 63 63 20 3d | 20 72 65 61 64 28 30 2c |f ((cc =| read(0,|
|000019f0| 20 26 63 2c 20 31 29 29 | 20 21 3d 20 31 29 20 7b | &c, 1))| != 1) {|
|00001a00| 0a 09 09 09 69 66 20 28 | 63 63 20 3c 20 30 29 0a |....if (|cc < 0).|
|00001a10| 09 09 09 09 73 79 73 6c | 6f 67 28 4c 4f 47 5f 4e |....sysl|og(LOG_N|
|00001a20| 4f 54 49 43 45 2c 20 22 | 72 65 61 64 3a 20 25 6d |OTICE, "|read: %m|
|00001a30| 22 29 3b 0a 09 09 09 73 | 68 75 74 64 6f 77 6e 28 |");....s|hutdown(|
|00001a40| 30 2c 20 31 2b 31 29 3b | 0a 09 09 09 65 78 69 74 |0, 1+1);|....exit|
|00001a50| 28 31 29 3b 0a 09 09 7d | 0a 09 09 69 66 20 28 63 |(1);...}|...if (c|
|00001a60| 20 3d 3d 20 30 29 0a 09 | 09 09 62 72 65 61 6b 3b | == 0)..|..break;|
|00001a70| 0a 09 09 70 6f 72 74 20 | 3d 20 70 6f 72 74 20 2a |...port |= port *|
|00001a80| 20 31 30 20 2b 20 63 20 | 2d 20 27 30 27 3b 0a 09 | 10 + c |- '0';..|
|00001a90| 7d 0a 0a 09 28 76 6f 69 | 64 29 20 61 6c 61 72 6d |}...(voi|d) alarm|
|00001aa0| 28 30 29 3b 0a 09 69 66 | 20 28 70 6f 72 74 20 21 |(0);..if| (port !|
|00001ab0| 3d 20 30 29 20 7b 0a 09 | 09 69 6e 74 20 6c 70 6f |= 0) {..|.int lpo|
|00001ac0| 72 74 20 3d 20 49 50 50 | 4f 52 54 5f 52 45 53 45 |rt = IPP|ORT_RESE|
|00001ad0| 52 56 45 44 20 2d 20 31 | 3b 0a 09 09 73 20 3d 20 |RVED - 1|;...s = |
|00001ae0| 72 72 65 73 76 70 6f 72 | 74 28 26 6c 70 6f 72 74 |rresvpor|t(&lport|
|00001af0| 29 3b 0a 09 09 69 66 20 | 28 73 20 3c 20 30 29 20 |);...if |(s < 0) |
|00001b00| 7b 0a 09 09 09 73 79 73 | 6c 6f 67 28 4c 4f 47 5f |{....sys|log(LOG_|
|00001b10| 45 52 52 2c 20 22 63 61 | 6e 27 74 20 67 65 74 20 |ERR, "ca|n't get |
|00001b20| 73 74 64 65 72 72 20 70 | 6f 72 74 3a 20 25 6d 22 |stderr p|ort: %m"|
|00001b30| 29 3b 0a 09 09 09 65 78 | 69 74 28 31 29 3b 0a 09 |);....ex|it(1);..|
|00001b40| 09 7d 0a 09 09 69 66 20 | 28 70 6f 72 74 20 3e 3d |.}...if |(port >=|
|00001b50| 20 49 50 50 4f 52 54 5f | 52 45 53 45 52 56 45 44 | IPPORT_|RESERVED|
|00001b60| 29 20 7b 0a 09 09 09 73 | 79 73 6c 6f 67 28 4c 4f |) {....s|yslog(LO|
|00001b70| 47 5f 45 52 52 2c 20 22 | 32 6e 64 20 70 6f 72 74 |G_ERR, "|2nd port|
|00001b80| 20 6e 6f 74 20 72 65 73 | 65 72 76 65 64 5c 6e 22 | not res|erved\n"|
|00001b90| 29 3b 0a 09 09 09 65 78 | 69 74 28 31 29 3b 0a 09 |);....ex|it(1);..|
|00001ba0| 09 7d 0a 09 09 66 72 6f | 6d 70 2d 3e 73 69 6e 5f |.}...fro|mp->sin_|
|00001bb0| 70 6f 72 74 20 3d 20 68 | 74 6f 6e 73 28 28 75 5f |port = h|tons((u_|
|00001bc0| 73 68 6f 72 74 29 70 6f | 72 74 29 3b 0a 09 09 69 |short)po|rt);...i|
|00001bd0| 66 20 28 63 6f 6e 6e 65 | 63 74 28 73 2c 20 66 72 |f (conne|ct(s, fr|
|00001be0| 6f 6d 70 2c 20 73 69 7a | 65 6f 66 20 28 2a 66 72 |omp, siz|eof (*fr|
|00001bf0| 6f 6d 70 29 29 20 3c 20 | 30 29 20 7b 0a 09 09 09 |omp)) < |0) {....|
|00001c00| 73 79 73 6c 6f 67 28 4c | 4f 47 5f 49 4e 46 4f 2c |syslog(L|OG_INFO,|
|00001c10| 20 22 63 6f 6e 6e 65 63 | 74 20 73 65 63 6f 6e 64 | "connec|t second|
|00001c20| 20 70 6f 72 74 3a 20 25 | 6d 22 29 3b 0a 09 09 09 | port: %|m");....|
|00001c30| 65 78 69 74 28 31 29 3b | 0a 09 09 7d 0a 09 7d 0a |exit(1);|...}..}.|
|00001c40| 0a 23 69 66 64 65 66 20 | 75 6c 74 72 69 78 20 2f |.#ifdef |ultrix /|
|00001c50| 2a 20 69 6e 65 74 64 20 | 64 6f 65 73 20 6e 6f 74 |* inetd |does not|
|00001c60| 20 73 65 74 20 75 70 20 | 31 20 61 6e 64 20 32 20 | set up |1 and 2 |
|00001c70| 2a 2f 0a 09 64 75 70 32 | 28 30 2c 20 31 29 3b 0a |*/..dup2|(0, 1);.|
|00001c80| 09 64 75 70 32 28 30 2c | 20 32 29 3b 0a 23 65 6e |.dup2(0,| 2);.#en|
|00001c90| 64 69 66 0a 0a 23 69 66 | 64 65 66 20 6e 6f 74 64 |dif..#if|def notd|
|00001ca0| 65 66 0a 09 2f 2a 20 66 | 72 6f 6d 20 69 6e 65 74 |ef../* f|rom inet|
|00001cb0| 64 2c 20 73 6f 63 6b 65 | 74 20 69 73 20 61 6c 72 |d, socke|t is alr|
|00001cc0| 65 61 64 79 20 6f 6e 20 | 30 2c 20 31 2c 20 32 20 |eady on |0, 1, 2 |
|00001cd0| 2a 2f 0a 09 64 75 70 32 | 28 66 2c 20 30 29 3b 0a |*/..dup2|(f, 0);.|
|00001ce0| 09 64 75 70 32 28 66 2c | 20 31 29 3b 0a 09 64 75 |.dup2(f,| 1);..du|
|00001cf0| 70 32 28 66 2c 20 32 29 | 3b 0a 23 65 6e 64 69 66 |p2(f, 2)|;.#endif|
|00001d00| 0a 09 68 70 20 3d 20 67 | 65 74 68 6f 73 74 62 79 |..hp = g|ethostby|
|00001d10| 61 64 64 72 28 28 63 68 | 61 72 20 2a 29 26 66 72 |addr((ch|ar *)&fr|
|00001d20| 6f 6d 70 2d 3e 73 69 6e | 5f 61 64 64 72 2c 20 73 |omp->sin|_addr, s|
|00001d30| 69 7a 65 6f 66 20 28 73 | 74 72 75 63 74 20 69 6e |izeof (s|truct in|
|00001d40| 5f 61 64 64 72 29 2c 0a | 09 09 66 72 6f 6d 70 2d |_addr),.|..fromp-|
|00001d50| 3e 73 69 6e 5f 66 61 6d | 69 6c 79 29 3b 0a 09 69 |>sin_fam|ily);..i|
|00001d60| 66 20 28 68 70 29 20 7b | 0a 09 09 2f 2a 0a 09 09 |f (hp) {|.../*...|
|00001d70| 20 2a 20 49 66 20 6e 61 | 6d 65 20 72 65 74 75 72 | * If na|me retur|
|00001d80| 6e 65 64 20 62 79 20 67 | 65 74 68 6f 73 74 62 79 |ned by g|ethostby|
|00001d90| 61 64 64 72 20 69 73 20 | 69 6e 20 6f 75 72 20 64 |addr is |in our d|
|00001da0| 6f 6d 61 69 6e 2c 0a 09 | 09 20 2a 20 61 74 74 65 |omain,..|. * atte|
|00001db0| 6d 70 74 20 74 6f 20 76 | 65 72 69 66 79 20 74 68 |mpt to v|erify th|
|00001dc0| 61 74 20 77 65 20 68 61 | 76 65 6e 27 74 20 62 65 |at we ha|ven't be|
|00001dd0| 65 6e 20 66 6f 6f 6c 65 | 64 20 62 79 20 73 6f 6d |en foole|d by som|
|00001de0| 65 6f 6e 65 0a 09 09 20 | 2a 20 69 6e 20 61 20 72 |eone... |* in a r|
|00001df0| 65 6d 6f 74 65 20 6e 65 | 74 3b 20 6c 6f 6f 6b 20 |emote ne|t; look |
|00001e00| 75 70 20 74 68 65 20 6e | 61 6d 65 20 61 6e 64 20 |up the n|ame and |
|00001e10| 63 68 65 63 6b 20 74 68 | 61 74 20 74 68 69 73 0a |check th|at this.|
|00001e20| 09 09 20 2a 20 61 64 64 | 72 65 73 73 20 63 6f 72 |.. * add|ress cor|
|00001e30| 72 65 73 70 6f 6e 64 73 | 20 74 6f 20 74 68 65 20 |responds| to the |
|00001e40| 6e 61 6d 65 2e 0a 09 09 | 20 2a 2f 0a 23 69 66 64 |name....| */.#ifd|
|00001e50| 65 66 20 62 75 67 0a 09 | 09 69 66 20 28 6c 6f 63 |ef bug..|.if (loc|
|00001e60| 61 6c 5f 64 6f 6d 61 69 | 6e 28 68 70 2d 3e 68 5f |al_domai|n(hp->h_|
|00001e70| 6e 61 6d 65 29 29 20 7b | 0a 23 65 6e 64 69 66 0a |name)) {|.#endif.|
|00001e80| 09 09 09 73 74 72 6e 63 | 70 79 28 72 65 6d 6f 74 |...strnc|py(remot|
|00001e90| 65 68 6f 73 74 2c 20 68 | 70 2d 3e 68 5f 6e 61 6d |ehost, h|p->h_nam|
|00001ea0| 65 2c 20 73 69 7a 65 6f | 66 28 72 65 6d 6f 74 65 |e, sizeo|f(remote|
|00001eb0| 68 6f 73 74 29 20 2d 20 | 31 29 3b 0a 09 09 09 72 |host) - |1);....r|
|00001ec0| 65 6d 6f 74 65 68 6f 73 | 74 5b 73 69 7a 65 6f 66 |emotehos|t[sizeof|
|00001ed0| 28 72 65 6d 6f 74 65 68 | 6f 73 74 29 20 2d 20 31 |(remoteh|ost) - 1|
|00001ee0| 5d 20 3d 20 30 3b 0a 09 | 09 09 68 70 20 3d 20 67 |] = 0;..|..hp = g|
|00001ef0| 65 74 68 6f 73 74 62 79 | 6e 61 6d 65 28 72 65 6d |ethostby|name(rem|
|00001f00| 6f 74 65 68 6f 73 74 29 | 3b 0a 09 09 09 69 66 20 |otehost)|;....if |
|00001f10| 28 68 70 20 3d 3d 20 4e | 55 4c 4c 29 20 7b 0a 09 |(hp == N|ULL) {..|
|00001f20| 09 09 09 73 79 73 6c 6f | 67 28 4c 4f 47 5f 49 4e |...syslo|g(LOG_IN|
|00001f30| 46 4f 2c 0a 09 09 09 09 | 20 20 20 20 22 43 6f 75 |FO,.....| "Cou|
|00001f40| 6c 64 6e 27 74 20 6c 6f | 6f 6b 20 75 70 20 61 64 |ldn't lo|ok up ad|
|00001f50| 64 72 65 73 73 20 66 6f | 72 20 25 73 22 2c 0a 09 |dress fo|r %s",..|
|00001f60| 09 09 09 20 20 20 20 72 | 65 6d 6f 74 65 68 6f 73 |... r|emotehos|
|00001f70| 74 29 3b 0a 09 09 09 09 | 65 72 72 6f 72 28 22 43 |t);.....|error("C|
|00001f80| 6f 75 6c 64 6e 27 74 20 | 6c 6f 6f 6b 20 75 70 20 |ouldn't |look up |
|00001f90| 61 64 64 72 65 73 73 20 | 66 6f 72 20 79 6f 75 72 |address |for your|
|00001fa0| 20 68 6f 73 74 22 29 3b | 0a 09 09 09 09 65 78 69 | host");|.....exi|
|00001fb0| 74 28 31 29 3b 0a 09 09 | 09 7d 20 65 6c 73 65 20 |t(1);...|.} else |
|00001fc0| 66 6f 72 20 28 3b 20 3b | 20 68 70 2d 3e 68 5f 61 |for (; ;| hp->h_a|
|00001fd0| 64 64 72 5f 6c 69 73 74 | 2b 2b 29 20 7b 0a 09 09 |ddr_list|++) {...|
|00001fe0| 09 09 69 66 20 28 21 62 | 63 6d 70 28 68 70 2d 3e |..if (!b|cmp(hp->|
|00001ff0| 68 5f 61 64 64 72 5f 6c | 69 73 74 5b 30 5d 2c 0a |h_addr_l|ist[0],.|
|00002000| 09 09 09 09 20 20 20 20 | 28 63 61 64 64 72 5f 74 |.... |(caddr_t|
|00002010| 29 26 66 72 6f 6d 70 2d | 3e 73 69 6e 5f 61 64 64 |)&fromp-|>sin_add|
|00002020| 72 2c 0a 09 09 09 09 20 | 20 20 20 73 69 7a 65 6f |r,..... | sizeo|
|00002030| 66 28 66 72 6f 6d 70 2d | 3e 73 69 6e 5f 61 64 64 |f(fromp-|>sin_add|
|00002040| 72 29 29 29 0a 09 09 09 | 09 09 62 72 65 61 6b 3b |r)))....|..break;|
|00002050| 0a 09 09 09 09 69 66 20 | 28 68 70 2d 3e 68 5f 61 |.....if |(hp->h_a|
|00002060| 64 64 72 5f 6c 69 73 74 | 5b 30 5d 20 3d 3d 20 4e |ddr_list|[0] == N|
|00002070| 55 4c 4c 29 20 7b 0a 09 | 09 09 09 09 73 79 73 6c |ULL) {..|....sysl|
|00002080| 6f 67 28 4c 4f 47 5f 4e | 4f 54 49 43 45 2c 0a 09 |og(LOG_N|OTICE,..|
|00002090| 09 09 09 09 20 20 22 48 | 6f 73 74 20 61 64 64 72 |.... "H|ost addr|
|000020a0| 20 25 73 20 6e 6f 74 20 | 6c 69 73 74 65 64 20 66 | %s not |listed f|
|000020b0| 6f 72 20 68 6f 73 74 20 | 25 73 22 2c 0a 09 09 09 |or host |%s",....|
|000020c0| 09 09 20 20 20 20 69 6e | 65 74 5f 6e 74 6f 61 28 |.. in|et_ntoa(|
|000020d0| 66 72 6f 6d 70 2d 3e 73 | 69 6e 5f 61 64 64 72 29 |fromp->s|in_addr)|
|000020e0| 2c 0a 09 09 09 09 09 20 | 20 20 20 68 70 2d 3e 68 |,...... | hp->h|
|000020f0| 5f 6e 61 6d 65 29 3b 0a | 09 09 09 09 09 65 72 72 |_name);.|.....err|
|00002100| 6f 72 28 22 48 6f 73 74 | 20 61 64 64 72 65 73 73 |or("Host| address|
|00002110| 20 6d 69 73 6d 61 74 63 | 68 22 29 3b 0a 09 09 09 | mismatc|h");....|
|00002120| 09 09 65 78 69 74 28 31 | 29 3b 0a 09 09 09 09 7d |..exit(1|);.....}|
|00002130| 0a 09 09 09 7d 0a 23 69 | 66 64 65 66 20 62 75 67 |....}.#i|fdef bug|
|00002140| 0a 09 09 7d 0a 09 09 68 | 6f 73 74 6e 61 6d 65 20 |...}...h|ostname |
|00002150| 3d 20 68 70 2d 3e 68 5f | 6e 61 6d 65 3b 0a 23 65 |= hp->h_|name;.#e|
|00002160| 6c 73 65 0a 09 09 68 6f | 73 74 6e 61 6d 65 20 3d |lse...ho|stname =|
|00002170| 20 72 65 6d 6f 74 65 68 | 6f 73 74 3b 0a 23 65 6e | remoteh|ost;.#en|
|00002180| 64 69 66 0a 09 7d 20 65 | 6c 73 65 0a 09 09 68 6f |dif..} e|lse...ho|
|00002190| 73 74 6e 61 6d 65 20 3d | 20 69 6e 65 74 5f 6e 74 |stname =| inet_nt|
|000021a0| 6f 61 28 66 72 6f 6d 70 | 2d 3e 73 69 6e 5f 61 64 |oa(fromp|->sin_ad|
|000021b0| 64 72 29 3b 0a 0a 09 67 | 65 74 73 74 72 28 72 65 |dr);...g|etstr(re|
|000021c0| 6d 75 73 65 72 2c 20 73 | 69 7a 65 6f 66 28 72 65 |muser, s|izeof(re|
|000021d0| 6d 75 73 65 72 29 2c 20 | 22 72 65 6d 75 73 65 72 |muser), |"remuser|
|000021e0| 22 29 3b 0a 09 67 65 74 | 73 74 72 28 6c 6f 63 75 |");..get|str(locu|
|000021f0| 73 65 72 2c 20 73 69 7a | 65 6f 66 28 6c 6f 63 75 |ser, siz|eof(locu|
|00002200| 73 65 72 29 2c 20 22 6c | 6f 63 75 73 65 72 22 29 |ser), "l|ocuser")|
|00002210| 3b 0a 09 67 65 74 73 74 | 72 28 63 6d 64 62 75 66 |;..getst|r(cmdbuf|
|00002220| 2c 20 73 69 7a 65 6f 66 | 28 63 6d 64 62 75 66 29 |, sizeof|(cmdbuf)|
|00002230| 2c 20 22 63 6f 6d 6d 61 | 6e 64 22 29 3b 0a 09 64 |, "comma|nd");..d|
|00002240| 6f 5f 61 63 63 65 73 73 | 28 70 72 6f 63 6e 61 6d |o_access|(procnam|
|00002250| 65 2c 20 68 6f 73 74 6e | 61 6d 65 2c 20 69 6e 65 |e, hostn|ame, ine|
|00002260| 74 5f 6e 74 6f 61 28 66 | 72 6f 6d 70 2d 3e 73 69 |t_ntoa(f|romp->si|
|00002270| 6e 5f 61 64 64 72 29 2c | 20 0a 09 09 72 65 6d 75 |n_addr),| ...remu|
|00002280| 73 65 72 2c 20 6c 6f 63 | 75 73 65 72 29 3b 0a 09 |ser, loc|user);..|
|00002290| 73 65 74 70 77 65 6e 74 | 28 29 3b 0a 09 70 77 64 |setpwent|();..pwd|
|000022a0| 20 3d 20 67 65 74 70 77 | 6e 61 6d 28 6c 6f 63 75 | = getpw|nam(locu|
|000022b0| 73 65 72 29 3b 0a 09 69 | 66 20 28 70 77 64 20 3d |ser);..i|f (pwd =|
|000022c0| 3d 20 4e 55 4c 4c 29 20 | 7b 0a 09 09 65 72 72 6f |= NULL) |{...erro|
|000022d0| 72 28 22 4c 6f 67 69 6e | 20 69 6e 63 6f 72 72 65 |r("Login| incorre|
|000022e0| 63 74 2e 5c 6e 22 29 3b | 0a 09 09 65 78 69 74 28 |ct.\n");|...exit(|
|000022f0| 31 29 3b 0a 09 7d 0a 09 | 65 6e 64 70 77 65 6e 74 |1);..}..|endpwent|
|00002300| 28 29 3b 0a 09 69 66 20 | 28 63 68 64 69 72 28 70 |();..if |(chdir(p|
|00002310| 77 64 2d 3e 70 77 5f 64 | 69 72 29 20 3c 20 30 29 |wd->pw_d|ir) < 0)|
|00002320| 20 7b 0a 09 09 28 76 6f | 69 64 29 20 63 68 64 69 | {...(vo|id) chdi|
|00002330| 72 28 22 2f 22 29 3b 0a | 23 69 66 64 65 66 20 6e |r("/");.|#ifdef n|
|00002340| 6f 74 64 65 66 0a 09 09 | 65 72 72 6f 72 28 22 4e |otdef...|error("N|
|00002350| 6f 20 72 65 6d 6f 74 65 | 20 64 69 72 65 63 74 6f |o remote| directo|
|00002360| 72 79 2e 5c 6e 22 29 3b | 0a 09 09 65 78 69 74 28 |ry.\n");|...exit(|
|00002370| 31 29 3b 0a 23 65 6e 64 | 69 66 0a 09 7d 0a 0a 09 |1);.#end|if..}...|
|00002380| 69 66 20 28 70 77 64 2d | 3e 70 77 5f 70 61 73 73 |if (pwd-|>pw_pass|
|00002390| 77 64 20 21 3d 20 30 20 | 26 26 20 2a 70 77 64 2d |wd != 0 |&& *pwd-|
|000023a0| 3e 70 77 5f 70 61 73 73 | 77 64 20 21 3d 20 27 5c |>pw_pass|wd != '\|
|000023b0| 30 27 20 26 26 0a 09 20 | 20 20 20 72 75 73 65 72 |0' &&.. | ruser|
|000023c0| 6f 6b 28 68 6f 73 74 6e | 61 6d 65 2c 20 70 77 64 |ok(hostn|ame, pwd|
|000023d0| 2d 3e 70 77 5f 75 69 64 | 20 3d 3d 20 30 2c 20 72 |->pw_uid| == 0, r|
|000023e0| 65 6d 75 73 65 72 2c 20 | 6c 6f 63 75 73 65 72 29 |emuser, |locuser)|
|000023f0| 20 3c 20 30 29 20 7b 0a | 09 09 65 72 72 6f 72 28 | < 0) {.|..error(|
|00002400| 22 50 65 72 6d 69 73 73 | 69 6f 6e 20 64 65 6e 69 |"Permiss|ion deni|
|00002410| 65 64 2e 5c 6e 22 29 3b | 0a 09 09 65 78 69 74 28 |ed.\n");|...exit(|
|00002420| 31 29 3b 0a 09 7d 0a 0a | 09 69 66 20 28 70 77 64 |1);..}..|.if (pwd|
|00002430| 2d 3e 70 77 5f 75 69 64 | 20 26 26 20 21 61 63 63 |->pw_uid| && !acc|
|00002440| 65 73 73 28 22 2f 65 74 | 63 2f 6e 6f 6c 6f 67 69 |ess("/et|c/nologi|
|00002450| 6e 22 2c 20 46 5f 4f 4b | 29 29 20 7b 0a 09 09 65 |n", F_OK|)) {...e|
|00002460| 72 72 6f 72 28 22 4c 6f | 67 69 6e 73 20 63 75 72 |rror("Lo|gins cur|
|00002470| 72 65 6e 74 6c 79 20 64 | 69 73 61 62 6c 65 64 2e |rently d|isabled.|
|00002480| 5c 6e 22 29 3b 0a 09 09 | 65 78 69 74 28 31 29 3b |\n");...|exit(1);|
|00002490| 0a 09 7d 0a 09 28 76 6f | 69 64 29 20 77 72 69 74 |..}..(vo|id) writ|
|000024a0| 65 28 32 2c 20 22 5c 30 | 22 2c 20 31 29 3b 0a 0a |e(2, "\0|", 1);..|
|000024b0| 09 69 66 20 28 70 6f 72 | 74 29 20 7b 0a 09 09 69 |.if (por|t) {...i|
|000024c0| 66 20 28 70 69 70 65 28 | 70 76 29 20 3c 20 30 29 |f (pipe(|pv) < 0)|
|000024d0| 20 7b 0a 09 09 09 65 72 | 72 6f 72 28 22 43 61 6e | {....er|ror("Can|
|000024e0| 27 74 20 6d 61 6b 65 20 | 70 69 70 65 2e 5c 6e 22 |'t make |pipe.\n"|
|000024f0| 29 3b 0a 09 09 09 65 78 | 69 74 28 31 29 3b 0a 09 |);....ex|it(1);..|
|00002500| 09 7d 0a 09 09 70 69 64 | 20 3d 20 66 6f 72 6b 28 |.}...pid| = fork(|
|00002510| 29 3b 0a 09 09 69 66 20 | 28 70 69 64 20 3d 3d 20 |);...if |(pid == |
|00002520| 2d 31 29 20 20 7b 0a 09 | 09 09 65 72 72 6f 72 28 |-1) {..|..error(|
|00002530| 22 54 72 79 20 61 67 61 | 69 6e 2e 5c 6e 22 29 3b |"Try aga|in.\n");|
|00002540| 0a 09 09 09 65 78 69 74 | 28 31 29 3b 0a 09 09 7d |....exit|(1);...}|
|00002550| 0a 09 09 69 66 20 28 70 | 76 5b 30 5d 20 3e 20 73 |...if (p|v[0] > s|
|00002560| 29 0a 09 09 09 6e 66 64 | 20 3d 20 70 76 5b 30 5d |)....nfd| = pv[0]|
|00002570| 3b 0a 09 09 65 6c 73 65 | 0a 09 09 09 6e 66 64 20 |;...else|....nfd |
|00002580| 3d 20 73 3b 0a 09 09 6e | 66 64 2b 2b 3b 0a 09 09 |= s;...n|fd++;...|
|00002590| 69 66 20 28 70 69 64 29 | 20 7b 0a 09 09 09 28 76 |if (pid)| {....(v|
|000025a0| 6f 69 64 29 20 63 6c 6f | 73 65 28 30 29 3b 20 28 |oid) clo|se(0); (|
|000025b0| 76 6f 69 64 29 20 63 6c | 6f 73 65 28 31 29 3b 20 |void) cl|ose(1); |
|000025c0| 28 76 6f 69 64 29 20 63 | 6c 6f 73 65 28 32 29 3b |(void) c|lose(2);|
|000025d0| 0a 09 09 09 28 76 6f 69 | 64 29 20 63 6c 6f 73 65 |....(voi|d) close|
|000025e0| 28 70 76 5b 31 5d 29 3b | 0a 09 09 09 46 44 5f 5a |(pv[1]);|....FD_Z|
|000025f0| 45 52 4f 28 26 72 65 61 | 64 66 72 6f 6d 29 3b 0a |ERO(&rea|dfrom);.|
|00002600| 09 09 09 46 44 5f 53 45 | 54 28 73 2c 20 26 72 65 |...FD_SE|T(s, &re|
|00002610| 61 64 66 72 6f 6d 29 3b | 0a 09 09 09 46 44 5f 53 |adfrom);|....FD_S|
|00002620| 45 54 28 70 76 5b 30 5d | 2c 20 26 72 65 61 64 66 |ET(pv[0]|, &readf|
|00002630| 72 6f 6d 29 3b 0a 09 09 | 09 69 6f 63 74 6c 28 70 |rom);...|.ioctl(p|
|00002640| 76 5b 30 5d 2c 20 46 49 | 4f 4e 42 49 4f 2c 20 28 |v[0], FI|ONBIO, (|
|00002650| 63 68 61 72 20 2a 29 26 | 6f 6e 65 29 3b 0a 09 09 |char *)&|one);...|
|00002660| 09 2f 2a 20 73 68 6f 75 | 6c 64 20 73 65 74 20 73 |./* shou|ld set s|
|00002670| 20 6e 62 69 6f 21 20 2a | 2f 0a 09 09 09 64 6f 20 | nbio! *|/....do |
|00002680| 7b 0a 09 09 09 09 72 65 | 61 64 79 20 3d 20 72 65 |{.....re|ady = re|
|00002690| 61 64 66 72 6f 6d 3b 0a | 09 09 09 09 69 66 20 28 |adfrom;.|....if (|
|000026a0| 73 65 6c 65 63 74 28 6e | 66 64 2c 20 26 72 65 61 |select(n|fd, &rea|
|000026b0| 64 79 2c 20 28 66 64 5f | 73 65 74 20 2a 29 30 2c |dy, (fd_|set *)0,|
|000026c0| 0a 09 09 09 09 20 20 20 | 20 28 66 64 5f 73 65 74 |..... | (fd_set|
|000026d0| 20 2a 29 30 2c 20 28 73 | 74 72 75 63 74 20 74 69 | *)0, (s|truct ti|
|000026e0| 6d 65 76 61 6c 20 2a 29 | 30 29 20 3c 20 30 29 0a |meval *)|0) < 0).|
|000026f0| 09 09 09 09 09 62 72 65 | 61 6b 3b 0a 09 09 09 09 |.....bre|ak;.....|
|00002700| 69 66 20 28 46 44 5f 49 | 53 53 45 54 28 73 2c 20 |if (FD_I|SSET(s, |
|00002710| 26 72 65 61 64 79 29 29 | 20 7b 0a 09 09 09 09 09 |&ready))| {......|
|00002720| 69 66 20 28 72 65 61 64 | 28 73 2c 20 26 73 69 67 |if (read|(s, &sig|
|00002730| 2c 20 31 29 20 3c 3d 20 | 30 29 0a 09 09 09 09 09 |, 1) <= |0)......|
|00002740| 09 46 44 5f 43 4c 52 28 | 73 2c 20 26 72 65 61 64 |.FD_CLR(|s, &read|
|00002750| 66 72 6f 6d 29 3b 0a 09 | 09 09 09 09 65 6c 73 65 |from);..|....else|
|00002760| 0a 09 09 09 09 09 09 6b | 69 6c 6c 70 67 28 70 69 |.......k|illpg(pi|
|00002770| 64 2c 20 73 69 67 29 3b | 0a 09 09 09 09 7d 0a 09 |d, sig);|.....}..|
|00002780| 09 09 09 69 66 20 28 46 | 44 5f 49 53 53 45 54 28 |...if (F|D_ISSET(|
|00002790| 70 76 5b 30 5d 2c 20 26 | 72 65 61 64 79 29 29 20 |pv[0], &|ready)) |
|000027a0| 7b 0a 09 09 09 09 09 65 | 72 72 6e 6f 20 3d 20 30 |{......e|rrno = 0|
|000027b0| 3b 0a 09 09 09 09 09 63 | 63 20 3d 20 72 65 61 64 |;......c|c = read|
|000027c0| 28 70 76 5b 30 5d 2c 20 | 62 75 66 2c 20 73 69 7a |(pv[0], |buf, siz|
|000027d0| 65 6f 66 20 28 62 75 66 | 29 29 3b 0a 09 09 09 09 |eof (buf|));.....|
|000027e0| 09 69 66 20 28 63 63 20 | 3c 3d 20 30 29 20 7b 0a |.if (cc |<= 0) {.|
|000027f0| 09 09 09 09 09 09 73 68 | 75 74 64 6f 77 6e 28 73 |......sh|utdown(s|
|00002800| 2c 20 31 2b 31 29 3b 0a | 09 09 09 09 09 09 46 44 |, 1+1);.|......FD|
|00002810| 5f 43 4c 52 28 70 76 5b | 30 5d 2c 20 26 72 65 61 |_CLR(pv[|0], &rea|
|00002820| 64 66 72 6f 6d 29 3b 0a | 09 09 09 09 09 7d 20 65 |dfrom);.|.....} e|
|00002830| 6c 73 65 0a 09 09 09 09 | 09 09 28 76 6f 69 64 29 |lse.....|..(void)|
|00002840| 20 77 72 69 74 65 28 73 | 2c 20 62 75 66 2c 20 63 | write(s|, buf, c|
|00002850| 63 29 3b 0a 09 09 09 09 | 7d 0a 09 09 09 7d 20 77 |c);.....|}....} w|
|00002860| 68 69 6c 65 20 28 46 44 | 5f 49 53 53 45 54 28 73 |hile (FD|_ISSET(s|
|00002870| 2c 20 26 72 65 61 64 66 | 72 6f 6d 29 20 7c 7c 0a |, &readf|rom) ||.|
|00002880| 09 09 09 20 20 20 20 46 | 44 5f 49 53 53 45 54 28 |... F|D_ISSET(|
|00002890| 70 76 5b 30 5d 2c 20 26 | 72 65 61 64 66 72 6f 6d |pv[0], &|readfrom|
|000028a0| 29 29 3b 0a 09 09 09 65 | 78 69 74 28 30 29 3b 0a |));....e|xit(0);.|
|000028b0| 09 09 7d 0a 09 09 73 65 | 74 70 67 72 70 28 30 2c |..}...se|tpgrp(0,|
|000028c0| 20 67 65 74 70 69 64 28 | 29 29 3b 0a 09 09 28 76 | getpid(|));...(v|
|000028d0| 6f 69 64 29 20 63 6c 6f | 73 65 28 73 29 3b 20 28 |oid) clo|se(s); (|
|000028e0| 76 6f 69 64 29 20 63 6c | 6f 73 65 28 70 76 5b 30 |void) cl|ose(pv[0|
|000028f0| 5d 29 3b 0a 09 09 64 75 | 70 32 28 70 76 5b 31 5d |]);...du|p2(pv[1]|
|00002900| 2c 20 32 29 3b 0a 09 7d | 0a 09 69 66 20 28 2a 70 |, 2);..}|..if (*p|
|00002910| 77 64 2d 3e 70 77 5f 73 | 68 65 6c 6c 20 3d 3d 20 |wd->pw_s|hell == |
|00002920| 27 5c 30 27 29 0a 09 09 | 70 77 64 2d 3e 70 77 5f |'\0')...|pwd->pw_|
|00002930| 73 68 65 6c 6c 20 3d 20 | 22 2f 62 69 6e 2f 73 68 |shell = |"/bin/sh|
|00002940| 22 3b 0a 09 28 76 6f 69 | 64 29 20 73 65 74 67 69 |";..(voi|d) setgi|
|00002950| 64 28 28 67 69 64 5f 74 | 29 70 77 64 2d 3e 70 77 |d((gid_t|)pwd->pw|
|00002960| 5f 67 69 64 29 3b 0a 09 | 69 6e 69 74 67 72 6f 75 |_gid);..|initgrou|
|00002970| 70 73 28 70 77 64 2d 3e | 70 77 5f 6e 61 6d 65 2c |ps(pwd->|pw_name,|
|00002980| 20 70 77 64 2d 3e 70 77 | 5f 67 69 64 29 3b 0a 09 | pwd->pw|_gid);..|
|00002990| 28 76 6f 69 64 29 20 73 | 65 74 75 69 64 28 28 75 |(void) s|etuid((u|
|000029a0| 69 64 5f 74 29 70 77 64 | 2d 3e 70 77 5f 75 69 64 |id_t)pwd|->pw_uid|
|000029b0| 29 3b 0a 09 65 6e 76 69 | 72 6f 6e 20 3d 20 65 6e |);..envi|ron = en|
|000029c0| 76 69 6e 69 74 3b 0a 09 | 73 74 72 6e 63 61 74 28 |vinit;..|strncat(|
|000029d0| 68 6f 6d 65 64 69 72 2c | 20 70 77 64 2d 3e 70 77 |homedir,| pwd->pw|
|000029e0| 5f 64 69 72 2c 20 73 69 | 7a 65 6f 66 28 68 6f 6d |_dir, si|zeof(hom|
|000029f0| 65 64 69 72 29 2d 36 29 | 3b 0a 09 73 74 72 6e 63 |edir)-6)|;..strnc|
|00002a00| 61 74 28 73 68 65 6c 6c | 2c 20 70 77 64 2d 3e 70 |at(shell|, pwd->p|
|00002a10| 77 5f 73 68 65 6c 6c 2c | 20 73 69 7a 65 6f 66 28 |w_shell,| sizeof(|
|00002a20| 73 68 65 6c 6c 29 2d 37 | 29 3b 0a 09 73 74 72 6e |shell)-7|);..strn|
|00002a30| 63 61 74 28 75 73 65 72 | 6e 61 6d 65 2c 20 70 77 |cat(user|name, pw|
|00002a40| 64 2d 3e 70 77 5f 6e 61 | 6d 65 2c 20 73 69 7a 65 |d->pw_na|me, size|
|00002a50| 6f 66 28 75 73 65 72 6e | 61 6d 65 29 2d 36 29 3b |of(usern|ame)-6);|
|00002a60| 0a 09 63 70 20 3d 20 72 | 69 6e 64 65 78 28 70 77 |..cp = r|index(pw|
|00002a70| 64 2d 3e 70 77 5f 73 68 | 65 6c 6c 2c 20 27 2f 27 |d->pw_sh|ell, '/'|
|00002a80| 29 3b 0a 09 69 66 20 28 | 63 70 29 0a 09 09 63 70 |);..if (|cp)...cp|
|00002a90| 2b 2b 3b 0a 09 65 6c 73 | 65 0a 09 09 63 70 20 3d |++;..els|e...cp =|
|00002aa0| 20 70 77 64 2d 3e 70 77 | 5f 73 68 65 6c 6c 3b 0a | pwd->pw|_shell;.|
|00002ab0| 09 65 78 65 63 6c 28 70 | 77 64 2d 3e 70 77 5f 73 |.execl(p|wd->pw_s|
|00002ac0| 68 65 6c 6c 2c 20 63 70 | 2c 20 22 2d 63 22 2c 20 |hell, cp|, "-c", |
|00002ad0| 63 6d 64 62 75 66 2c 20 | 30 29 3b 0a 09 70 65 72 |cmdbuf, |0);..per|
|00002ae0| 72 6f 72 28 70 77 64 2d | 3e 70 77 5f 73 68 65 6c |ror(pwd-|>pw_shel|
|00002af0| 6c 29 3b 0a 09 65 78 69 | 74 28 31 29 3b 0a 7d 0a |l);..exi|t(1);.}.|
|00002b00| 0a 2f 2a 56 41 52 41 52 | 47 53 31 2a 2f 0a 65 72 |./*VARAR|GS1*/.er|
|00002b10| 72 6f 72 28 66 6d 74 2c | 20 61 31 2c 20 61 32 2c |ror(fmt,| a1, a2,|
|00002b20| 20 61 33 29 0a 09 63 68 | 61 72 20 2a 66 6d 74 3b | a3)..ch|ar *fmt;|
|00002b30| 0a 09 69 6e 74 20 61 31 | 2c 20 61 32 2c 20 61 33 |..int a1|, a2, a3|
|00002b40| 3b 0a 7b 0a 09 63 68 61 | 72 20 62 75 66 5b 42 55 |;.{..cha|r buf[BU|
|00002b50| 46 53 49 5a 5d 3b 0a 0a | 09 62 75 66 5b 30 5d 20 |FSIZ];..|.buf[0] |
|00002b60| 3d 20 31 3b 0a 09 28 76 | 6f 69 64 29 20 73 70 72 |= 1;..(v|oid) spr|
|00002b70| 69 6e 74 66 28 62 75 66 | 2b 31 2c 20 66 6d 74 2c |intf(buf|+1, fmt,|
|00002b80| 20 61 31 2c 20 61 32 2c | 20 61 33 29 3b 0a 09 28 | a1, a2,| a3);..(|
|00002b90| 76 6f 69 64 29 20 77 72 | 69 74 65 28 32 2c 20 62 |void) wr|ite(2, b|
|00002ba0| 75 66 2c 20 73 74 72 6c | 65 6e 28 62 75 66 29 29 |uf, strl|en(buf))|
|00002bb0| 3b 0a 7d 0a 0a 67 65 74 | 73 74 72 28 62 75 66 2c |;.}..get|str(buf,|
|00002bc0| 20 63 6e 74 2c 20 65 72 | 72 29 0a 09 63 68 61 72 | cnt, er|r)..char|
|00002bd0| 20 2a 62 75 66 3b 0a 09 | 69 6e 74 20 63 6e 74 3b | *buf;..|int cnt;|
|00002be0| 0a 09 63 68 61 72 20 2a | 65 72 72 3b 0a 7b 0a 09 |..char *|err;.{..|
|00002bf0| 63 68 61 72 20 63 3b 0a | 0a 09 64 6f 20 7b 0a 09 |char c;.|..do {..|
|00002c00| 09 69 66 20 28 72 65 61 | 64 28 30 2c 20 26 63 2c |.if (rea|d(0, &c,|
|00002c10| 20 31 29 20 21 3d 20 31 | 29 0a 09 09 09 65 78 69 | 1) != 1|)....exi|
|00002c20| 74 28 31 29 3b 0a 09 09 | 2a 62 75 66 2b 2b 20 3d |t(1);...|*buf++ =|
|00002c30| 20 63 3b 0a 09 09 69 66 | 20 28 2d 2d 63 6e 74 20 | c;...if| (--cnt |
|00002c40| 3d 3d 20 30 29 20 7b 0a | 09 09 09 65 72 72 6f 72 |== 0) {.|...error|
|00002c50| 28 22 25 73 20 74 6f 6f | 20 6c 6f 6e 67 5c 6e 22 |("%s too| long\n"|
|00002c60| 2c 20 65 72 72 29 3b 0a | 09 09 09 65 78 69 74 28 |, err);.|...exit(|
|00002c70| 31 29 3b 0a 09 09 7d 0a | 09 7d 20 77 68 69 6c 65 |1);...}.|.} while|
|00002c80| 20 28 63 20 21 3d 20 30 | 29 3b 0a 7d 0a 0a 2f 2a | (c != 0|);.}../*|
|00002c90| 0a 20 2a 20 43 68 65 63 | 6b 20 77 68 65 74 68 65 |. * Chec|k whethe|
|00002ca0| 72 20 68 6f 73 74 20 68 | 20 69 73 20 69 6e 20 6f |r host h| is in o|
|00002cb0| 75 72 20 6c 6f 63 61 6c | 20 64 6f 6d 61 69 6e 2c |ur local| domain,|
|00002cc0| 0a 20 2a 20 61 73 20 64 | 65 74 65 72 6d 69 6e 65 |. * as d|etermine|
|00002cd0| 64 20 62 79 20 74 68 65 | 20 70 61 72 74 20 6f 66 |d by the| part of|
|00002ce0| 20 74 68 65 20 6e 61 6d | 65 20 66 6f 6c 6c 6f 77 | the nam|e follow|
|00002cf0| 69 6e 67 0a 20 2a 20 74 | 68 65 20 66 69 72 73 74 |ing. * t|he first|
|00002d00| 20 27 2e 27 20 69 6e 20 | 69 74 73 20 6e 61 6d 65 | '.' in |its name|
|00002d10| 20 61 6e 64 20 69 6e 20 | 6f 75 72 73 2e 0a 20 2a | and in |ours.. *|
|00002d20| 20 49 66 20 65 69 74 68 | 65 72 20 6e 61 6d 65 20 | If eith|er name |
|00002d30| 69 73 20 75 6e 71 75 61 | 6c 69 66 69 65 64 20 28 |is unqua|lified (|
|00002d40| 63 6f 6e 74 61 69 6e 73 | 20 6e 6f 20 27 2e 27 29 |contains| no '.')|
|00002d50| 2c 0a 20 2a 20 61 73 73 | 75 6d 65 20 74 68 61 74 |,. * ass|ume that|
|00002d60| 20 74 68 65 20 68 6f 73 | 74 20 69 73 20 6c 6f 63 | the hos|t is loc|
|00002d70| 61 6c 2c 20 61 73 20 69 | 74 20 77 69 6c 6c 20 62 |al, as i|t will b|
|00002d80| 65 0a 20 2a 20 69 6e 74 | 65 72 70 72 65 74 65 64 |e. * int|erpreted|
|00002d90| 20 61 73 20 73 75 63 68 | 2e 0a 20 2a 2f 0a 6c 6f | as such|.. */.lo|
|00002da0| 63 61 6c 5f 64 6f 6d 61 | 69 6e 28 68 29 0a 09 63 |cal_doma|in(h)..c|
|00002db0| 68 61 72 20 2a 68 3b 0a | 7b 0a 09 63 68 61 72 20 |har *h;.|{..char |
|00002dc0| 6c 6f 63 61 6c 68 6f 73 | 74 5b 4d 41 58 48 4f 53 |localhos|t[MAXHOS|
|00002dd0| 54 4e 41 4d 45 4c 45 4e | 5d 3b 0a 09 63 68 61 72 |TNAMELEN|];..char|
|00002de0| 20 2a 70 31 2c 20 2a 70 | 32 20 3d 20 69 6e 64 65 | *p1, *p|2 = inde|
|00002df0| 78 28 68 2c 20 27 2e 27 | 29 3b 0a 0a 09 28 76 6f |x(h, '.'|);...(vo|
|00002e00| 69 64 29 20 67 65 74 68 | 6f 73 74 6e 61 6d 65 28 |id) geth|ostname(|
|00002e10| 6c 6f 63 61 6c 68 6f 73 | 74 2c 20 73 69 7a 65 6f |localhos|t, sizeo|
|00002e20| 66 28 6c 6f 63 61 6c 68 | 6f 73 74 29 29 3b 0a 09 |f(localh|ost));..|
|00002e30| 70 31 20 3d 20 69 6e 64 | 65 78 28 6c 6f 63 61 6c |p1 = ind|ex(local|
|00002e40| 68 6f 73 74 2c 20 27 2e | 27 29 3b 0a 09 69 66 20 |host, '.|');..if |
|00002e50| 28 70 31 20 3d 3d 20 4e | 55 4c 4c 20 7c 7c 20 70 |(p1 == N|ULL || p|
|00002e60| 32 20 3d 3d 20 4e 55 4c | 4c 20 7c 7c 20 21 73 74 |2 == NUL|L || !st|
|00002e70| 72 63 61 73 65 63 6d 70 | 28 70 31 2c 20 70 32 29 |rcasecmp|(p1, p2)|
|00002e80| 29 0a 09 09 72 65 74 75 | 72 6e 28 31 29 3b 0a 09 |)...retu|rn(1);..|
|00002e90| 72 65 74 75 72 6e 28 30 | 29 3b 0a 7d 0a 0a 64 6f |return(0|);.}..do|
|00002ea0| 5f 61 63 63 65 73 73 28 | 64 61 65 6d 6f 6e 2c 20 |_access(|daemon, |
|00002eb0| 68 6f 73 74 2c 20 61 64 | 64 72 2c 20 72 75 73 65 |host, ad|dr, ruse|
|00002ec0| 72 2c 20 6c 75 73 65 72 | 29 0a 63 68 61 72 20 20 |r, luser|).char |
|00002ed0| 20 2a 64 61 65 6d 6f 6e | 3b 0a 63 68 61 72 20 20 | *daemon|;.char |
|00002ee0| 20 2a 68 6f 73 74 3b 0a | 63 68 61 72 20 20 20 2a | *host;.|char *|
|00002ef0| 61 64 64 72 3b 0a 63 68 | 61 72 20 20 20 2a 72 75 |addr;.ch|ar *ru|
|00002f00| 73 65 72 3b 0a 63 68 61 | 72 20 20 20 2a 6c 75 73 |ser;.cha|r *lus|
|00002f10| 65 72 3b 0a 7b 0a 20 20 | 20 20 69 6e 74 20 20 20 |er;.{. | int |
|00002f20| 20 20 61 6c 6c 6f 77 20 | 3d 20 68 6f 73 74 73 5f | allow |= hosts_|
|00002f30| 63 74 6c 28 64 61 65 6d | 6f 6e 2c 20 73 74 72 63 |ctl(daem|on, strc|
|00002f40| 6d 70 28 68 6f 73 74 2c | 20 61 64 64 72 29 20 3f |mp(host,| addr) ?|
|00002f50| 20 68 6f 73 74 20 3a 20 | 22 75 6e 6b 6e 6f 77 6e | host : |"unknown|
|00002f60| 22 2c 0a 09 09 09 20 20 | 20 20 20 20 61 64 64 72 |",.... | addr|
|00002f70| 2c 20 72 75 73 65 72 29 | 3b 0a 20 20 20 20 63 68 |, ruser)|;. ch|
|00002f80| 61 72 20 20 20 2a 74 65 | 78 74 20 3d 20 61 6c 6c |ar *te|xt = all|
|00002f90| 6f 77 20 3f 20 22 22 20 | 3a 20 22 72 65 66 75 73 |ow ? "" |: "refus|
|00002fa0| 65 64 20 22 3b 0a 0a 20 | 20 20 20 69 66 20 28 73 |ed ";.. | if (s|
|00002fb0| 74 72 63 6d 70 28 72 75 | 73 65 72 2c 20 6c 75 73 |trcmp(ru|ser, lus|
|00002fc0| 65 72 29 20 3d 3d 20 30 | 29 0a 09 73 79 73 6c 6f |er) == 0|)..syslo|
|00002fd0| 67 28 4c 4f 47 5f 49 4e | 46 4f 2c 20 22 25 73 63 |g(LOG_IN|FO, "%sc|
|00002fe0| 6f 6e 6e 65 63 74 20 66 | 72 6f 6d 20 25 73 40 25 |onnect f|rom %s@%|
|00002ff0| 73 22 2c 0a 09 20 20 20 | 20 20 20 20 74 65 78 74 |s",.. | text|
|00003000| 2c 20 72 75 73 65 72 2c | 20 68 6f 73 74 29 3b 0a |, ruser,| host);.|
|00003010| 20 20 20 20 65 6c 73 65 | 0a 09 73 79 73 6c 6f 67 | else|..syslog|
|00003020| 28 4c 4f 47 5f 49 4e 46 | 4f 2c 20 22 25 73 63 6f |(LOG_INF|O, "%sco|
|00003030| 6e 6e 65 63 74 20 66 72 | 6f 6d 20 25 73 40 25 73 |nnect fr|om %s@%s|
|00003040| 20 74 6f 20 25 73 22 2c | 0a 09 20 20 20 20 20 20 | to %s",|.. |
|00003050| 20 74 65 78 74 2c 20 72 | 75 73 65 72 2c 20 68 6f | text, r|user, ho|
|00003060| 73 74 2c 20 6c 75 73 65 | 72 29 3b 0a 20 20 20 20 |st, luse|r);. |
|00003070| 69 66 20 28 21 61 6c 6c | 6f 77 29 0a 09 65 78 69 |if (!all|ow)..exi|
|00003080| 74 28 30 29 3b 0a 7d 0a | 4f 54 49 43 45 2c 0a 09 |t(0);.}.|OTICE,..|
|00003090| 09 09 09 09 20 20 22 48 | 6f 73 74 20 61 64 64 72 |.... "H|ost addr|
|000030a0| 20 25 73 20 6e 6f 74 20 | 6c 69 73 74 65 64 20 66 | %s not |listed f|
|000030b0| 6f 72 20 68 6f 73 74 20 | 25 73 22 2c 0a 09 09 09 |or host |%s",....|
|000030c0| 09 09 20 20 20 20 69 6e | 65 74 5f 6e 74 6f 61 28 |.. in|et_ntoa(|
|000030d0| 66 72 6f 6d 70 2d 3e 73 | 69 6e 5f 61 64 64 72 29 |fromp->s|in_addr)|
|000030e0| 2c 0a 09 09 09 09 09 20 | 20 20 20 68 70 2d 3e 68 |,...... | hp->h|
|000030f0| 5f 6e 61 6d 65 29 3b 0a | 09 09 09 09 09 65 72 72 |_name);.|.....err|
|00003100| 6f 72 28 22 48 6f 73 74 | 20 61 64 64 72 65 73 73 |or("Host| address|
|00003110| 20 6d 69 73 6d 61 74 63 | 68 22 29 3b 0a 09 09 09 | mismatc|h");....|
|00003120| 09 09 65 78 69 74 28 31 | 29 3b 0a 09 09 09 09 7d |..exit(1|);.....}|
|00003130| 0a 09 09 09 7d 0a 23 69 | 66 64 65 66 20 62 75 67 |....}.#i|fdef bug|
|00003140| 0a 09 09 7d 0a 09 09 68 | 6f 73 74 6e 61 6d 65 20 |...}...h|ostname |
|00003150| 3d 20 68 70 2d 3e 68 5f | 6e 61 6d 65 3b 0a 23 65 |= hp->h_|name;.#e|
|00003160| 6c 73 65 0a 09 09 68 6f | 73 74 6e 61 6d 65 20 3d |lse...ho|stname =|
|00003170| 20 72 65 6d 6f 74 65 68 | 6f 73 74 3b 0a 23 65 6e | remoteh|ost;.#en|
|00003180| 64 69 66 0a 09 7d 20 65 | 6c 73 65 0a 09 09 68 6f |dif..} e|lse...ho|
|00003190| 73 74 6e 61 6d 65 20 3d | 20 69 6e 65 74 5f 6e 74 |stname =| inet_nt|
|000031a0| 6f 61 28 66 72 6f 6d 70 | 2d 3e 73 69 6e 5f 61 64 |oa(fromp|->sin_ad|
|000031b0| 64 72 29 3b 0a 0a 09 67 | 65 74 73 74 72 28 72 65 |dr);...g|etstr(re|
|000031c0| 6d 75 73 65 72 2c 20 73 | 69 7a 65 6f 66 28 72 65 |muser, s|izeof(re|
|000031d0| 6d 75 73 65 72 29 2c 20 | 22 72 65 6d 75 73 65 72 |muser), |"remuser|
|000031e0| 22 29 3b 0a 09 67 65 74 | 73 74 72 28 6c 6f 63 75 |");..get|str(locu|
|000031f0| 73 65 72 2c 20 73 69 7a | 65 6f 66 28 6c 6f 63 75 |ser, siz|eof(locu|
|00003200| 6c 6f 67 64 61 65 6d 6f | 6e 2d 32 2f 72 73 68 64 |logdaemo|n-2/rshd|
|00003210| 2f 72 73 68 64 2e 38 00 | 00 00 00 00 00 00 00 00 |/rshd.8.|........|
|00003220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003260| 00 00 00 00 20 20 20 34 | 34 34 20 00 20 20 20 34 |.... 4|44 . 4|
|00003270| 36 35 20 00 20 20 20 35 | 30 36 20 00 20 20 20 20 |65 . 5|06 . |
|00003280| 20 20 31 32 33 34 36 20 | 20 34 33 31 35 33 36 32 | 12346 | 4315362|
|00003290| 36 30 33 20 20 31 30 32 | 36 32 00 20 00 00 00 00 |603 102|62. ....|
|000032a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003400| 2e 5c 22 20 43 6f 70 79 | 72 69 67 68 74 20 28 63 |.\" Copy|right (c|
|00003410| 29 20 31 39 38 33 20 54 | 68 65 20 52 65 67 65 6e |) 1983 T|he Regen|
|00003420| 74 73 20 6f 66 20 74 68 | 65 20 55 6e 69 76 65 72 |ts of th|e Univer|
|00003430| 73 69 74 79 20 6f 66 20 | 43 61 6c 69 66 6f 72 6e |sity of |Californ|
|00003440| 69 61 2e 0a 2e 5c 22 20 | 41 6c 6c 20 72 69 67 68 |ia...\" |All righ|
|00003450| 74 73 20 72 65 73 65 72 | 76 65 64 2e 0a 2e 5c 22 |ts reser|ved...\"|
|00003460| 0a 2e 5c 22 20 52 65 64 | 69 73 74 72 69 62 75 74 |..\" Red|istribut|
|00003470| 69 6f 6e 20 61 6e 64 20 | 75 73 65 20 69 6e 20 73 |ion and |use in s|
|00003480| 6f 75 72 63 65 20 61 6e | 64 20 62 69 6e 61 72 79 |ource an|d binary|
|00003490| 20 66 6f 72 6d 73 20 61 | 72 65 20 70 65 72 6d 69 | forms a|re permi|
|000034a0| 74 74 65 64 0a 2e 5c 22 | 20 70 72 6f 76 69 64 65 |tted..\"| provide|
|000034b0| 64 20 74 68 61 74 20 74 | 68 65 20 61 62 6f 76 65 |d that t|he above|
|000034c0| 20 63 6f 70 79 72 69 67 | 68 74 20 6e 6f 74 69 63 | copyrig|ht notic|
|000034d0| 65 20 61 6e 64 20 74 68 | 69 73 20 70 61 72 61 67 |e and th|is parag|
|000034e0| 72 61 70 68 20 61 72 65 | 0a 2e 5c 22 20 64 75 70 |raph are|..\" dup|
|000034f0| 6c 69 63 61 74 65 64 20 | 69 6e 20 61 6c 6c 20 73 |licated |in all s|
|00003500| 75 63 68 20 66 6f 72 6d | 73 20 61 6e 64 20 74 68 |uch form|s and th|
|00003510| 61 74 20 61 6e 79 20 64 | 6f 63 75 6d 65 6e 74 61 |at any d|ocumenta|
|00003520| 74 69 6f 6e 2c 0a 2e 5c | 22 20 61 64 76 65 72 74 |tion,..\|" advert|
|00003530| 69 73 69 6e 67 20 6d 61 | 74 65 72 69 61 6c 73 2c |ising ma|terials,|
|00003540| 20 61 6e 64 20 6f 74 68 | 65 72 20 6d 61 74 65 72 | and oth|er mater|
|00003550| 69 61 6c 73 20 72 65 6c | 61 74 65 64 20 74 6f 20 |ials rel|ated to |
|00003560| 73 75 63 68 0a 2e 5c 22 | 20 64 69 73 74 72 69 62 |such..\"| distrib|
|00003570| 75 74 69 6f 6e 20 61 6e | 64 20 75 73 65 20 61 63 |ution an|d use ac|
|00003580| 6b 6e 6f 77 6c 65 64 67 | 65 20 74 68 61 74 20 74 |knowledg|e that t|
|00003590| 68 65 20 73 6f 66 74 77 | 61 72 65 20 77 61 73 20 |he softw|are was |
|000035a0| 64 65 76 65 6c 6f 70 65 | 64 0a 2e 5c 22 20 62 79 |develope|d..\" by|
|000035b0| 20 74 68 65 20 55 6e 69 | 76 65 72 73 69 74 79 20 | the Uni|versity |
|000035c0| 6f 66 20 43 61 6c 69 66 | 6f 72 6e 69 61 2c 20 42 |of Calif|ornia, B|
|000035d0| 65 72 6b 65 6c 65 79 2e | 20 20 54 68 65 20 6e 61 |erkeley.| The na|
|000035e0| 6d 65 20 6f 66 20 74 68 | 65 0a 2e 5c 22 20 55 6e |me of th|e..\" Un|
|000035f0| 69 76 65 72 73 69 74 79 | 20 6d 61 79 20 6e 6f 74 |iversity| may not|
|00003600| 20 62 65 20 75 73 65 64 | 20 74 6f 20 65 6e 64 6f | be used| to endo|
|00003610| 72 73 65 20 6f 72 20 70 | 72 6f 6d 6f 74 65 20 70 |rse or p|romote p|
|00003620| 72 6f 64 75 63 74 73 20 | 64 65 72 69 76 65 64 0a |roducts |derived.|
|00003630| 2e 5c 22 20 66 72 6f 6d | 20 74 68 69 73 20 73 6f |.\" from| this so|
|00003640| 66 74 77 61 72 65 20 77 | 69 74 68 6f 75 74 20 73 |ftware w|ithout s|
|00003650| 70 65 63 69 66 69 63 20 | 70 72 69 6f 72 20 77 72 |pecific |prior wr|
|00003660| 69 74 74 65 6e 20 70 65 | 72 6d 69 73 73 69 6f 6e |itten pe|rmission|
|00003670| 2e 0a 2e 5c 22 20 54 48 | 49 53 20 53 4f 46 54 57 |...\" TH|IS SOFTW|
|00003680| 41 52 45 20 49 53 20 50 | 52 4f 56 49 44 45 44 20 |ARE IS P|ROVIDED |
|00003690| 60 60 41 53 20 49 53 27 | 27 20 41 4e 44 20 57 49 |``AS IS'|' AND WI|
|000036a0| 54 48 4f 55 54 20 41 4e | 59 20 45 58 50 52 45 53 |THOUT AN|Y EXPRES|
|000036b0| 53 20 4f 52 0a 2e 5c 22 | 20 49 4d 50 4c 49 45 44 |S OR..\"| IMPLIED|
|000036c0| 20 57 41 52 52 41 4e 54 | 49 45 53 2c 20 49 4e 43 | WARRANT|IES, INC|
|000036d0| 4c 55 44 49 4e 47 2c 20 | 57 49 54 48 4f 55 54 20 |LUDING, |WITHOUT |
|000036e0| 4c 49 4d 49 54 41 54 49 | 4f 4e 2c 20 54 48 45 20 |LIMITATI|ON, THE |
|000036f0| 49 4d 50 4c 49 45 44 0a | 2e 5c 22 20 57 41 52 52 |IMPLIED.|.\" WARR|
|00003700| 41 4e 54 49 45 53 20 4f | 46 20 4d 45 52 43 48 41 |ANTIES O|F MERCHA|
|00003710| 4e 54 49 42 49 4c 49 54 | 59 20 41 4e 44 20 46 49 |NTIBILIT|Y AND FI|
|00003720| 54 4e 45 53 53 20 46 4f | 52 20 41 20 50 41 52 54 |TNESS FO|R A PART|
|00003730| 49 43 55 4c 41 52 20 50 | 55 52 50 4f 53 45 2e 0a |ICULAR P|URPOSE..|
|00003740| 2e 5c 22 0a 2e 5c 22 09 | 40 28 23 29 72 73 68 64 |.\"..\".|@(#)rshd|
|00003750| 2e 38 09 36 2e 35 20 28 | 42 65 72 6b 65 6c 65 79 |.8.6.5 (|Berkeley|
|00003760| 29 20 39 2f 31 39 2f 38 | 38 0a 2e 5c 22 0a 2e 54 |) 9/19/8|8..\"..T|
|00003770| 48 20 52 53 48 44 20 38 | 20 22 53 65 70 74 65 6d |H RSHD 8| "Septem|
|00003780| 62 65 72 20 31 39 2c 20 | 31 39 38 38 22 0a 2e 55 |ber 19, |1988"..U|
|00003790| 43 20 35 0a 2e 53 48 20 | 4e 41 4d 45 0a 72 73 68 |C 5..SH |NAME.rsh|
|000037a0| 64 20 5c 2d 20 72 65 6d | 6f 74 65 20 73 68 65 6c |d \- rem|ote shel|
|000037b0| 6c 20 73 65 72 76 65 72 | 0a 2e 53 48 20 53 59 4e |l server|..SH SYN|
|000037c0| 4f 50 53 49 53 0a 2e 42 | 20 2f 65 74 63 2f 72 73 |OPSIS..B| /etc/rs|
|000037d0| 68 64 0a 2e 53 48 20 44 | 45 53 43 52 49 50 54 49 |hd..SH D|ESCRIPTI|
|000037e0| 4f 4e 0a 2e 49 20 52 73 | 68 64 0a 69 73 20 74 68 |ON..I Rs|hd.is th|
|000037f0| 65 20 73 65 72 76 65 72 | 20 66 6f 72 20 74 68 65 |e server| for the|
|00003800| 20 0a 2e 49 52 20 72 63 | 6d 64 20 28 33 58 29 0a | ..IR rc|md (3X).|
|00003810| 72 6f 75 74 69 6e 65 20 | 61 6e 64 2c 20 63 6f 6e |routine |and, con|
|00003820| 73 65 71 75 65 6e 74 6c | 79 2c 20 66 6f 72 20 74 |sequentl|y, for t|
|00003830| 68 65 0a 2e 49 52 20 72 | 73 68 20 28 31 43 29 0a |he..IR r|sh (1C).|
|00003840| 70 72 6f 67 72 61 6d 2e | 20 20 54 68 65 20 73 65 |program.| The se|
|00003850| 72 76 65 72 20 70 72 6f | 76 69 64 65 73 20 72 65 |rver pro|vides re|
|00003860| 6d 6f 74 65 20 65 78 65 | 63 75 74 69 6f 6e 20 66 |mote exe|cution f|
|00003870| 61 63 69 6c 69 74 69 65 | 73 0a 77 69 74 68 20 61 |acilitie|s.with a|
|00003880| 75 74 68 65 6e 74 69 63 | 61 74 69 6f 6e 20 62 61 |uthentic|ation ba|
|00003890| 73 65 64 20 6f 6e 20 70 | 72 69 76 69 6c 65 67 65 |sed on p|rivilege|
|000038a0| 64 20 70 6f 72 74 20 6e | 75 6d 62 65 72 73 20 66 |d port n|umbers f|
|000038b0| 72 6f 6d 20 74 72 75 73 | 74 65 64 20 68 6f 73 74 |rom trus|ted host|
|000038c0| 73 2e 0a 2e 50 50 0a 2e | 49 20 52 73 68 64 0a 6c |s...PP..|I Rshd.l|
|000038d0| 69 73 74 65 6e 73 20 66 | 6f 72 20 73 65 72 76 69 |istens f|or servi|
|000038e0| 63 65 20 72 65 71 75 65 | 73 74 73 20 61 74 20 74 |ce reque|sts at t|
|000038f0| 68 65 20 70 6f 72 74 20 | 69 6e 64 69 63 61 74 65 |he port |indicate|
|00003900| 64 20 69 6e 0a 74 68 65 | 20 60 60 63 6d 64 27 27 |d in.the| ``cmd''|
|00003910| 20 73 65 72 76 69 63 65 | 20 73 70 65 63 69 66 69 | service| specifi|
|00003920| 63 61 74 69 6f 6e 3b 20 | 73 65 65 0a 2e 49 52 20 |cation; |see..IR |
|00003930| 73 65 72 76 69 63 65 73 | 20 28 35 29 2e 0a 57 68 |services| (5)..Wh|
|00003940| 65 6e 20 61 20 73 65 72 | 76 69 63 65 20 72 65 71 |en a ser|vice req|
|00003950| 75 65 73 74 20 69 73 20 | 72 65 63 65 69 76 65 64 |uest is |received|
|00003960| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 70 | the fol|lowing p|
|00003970| 72 6f 74 6f 63 6f 6c 0a | 69 73 20 69 6e 69 74 69 |rotocol.|is initi|
|00003980| 61 74 65 64 3a 0a 2e 49 | 50 20 31 29 0a 54 68 65 |ated:..I|P 1).The|
|00003990| 20 73 65 72 76 65 72 20 | 63 68 65 63 6b 73 20 74 | server |checks t|
|000039a0| 68 65 20 63 6c 69 65 6e | 74 27 73 20 73 6f 75 72 |he clien|t's sour|
|000039b0| 63 65 20 70 6f 72 74 2e | 0a 49 66 20 74 68 65 20 |ce port.|.If the |
|000039c0| 70 6f 72 74 20 69 73 20 | 6e 6f 74 20 69 6e 20 74 |port is |not in t|
|000039d0| 68 65 20 72 61 6e 67 65 | 20 30 2d 31 30 32 33 2c |he range| 0-1023,|
|000039e0| 20 74 68 65 20 73 65 72 | 76 65 72 0a 61 62 6f 72 | the ser|ver.abor|
|000039f0| 74 73 20 74 68 65 20 63 | 6f 6e 6e 65 63 74 69 6f |ts the c|onnectio|
|00003a00| 6e 2e 0a 2e 49 50 20 32 | 29 0a 54 68 65 20 73 65 |n...IP 2|).The se|
|00003a10| 72 76 65 72 20 72 65 61 | 64 73 20 63 68 61 72 61 |rver rea|ds chara|
|00003a20| 63 74 65 72 73 20 66 72 | 6f 6d 20 74 68 65 20 73 |cters fr|om the s|
|00003a30| 6f 63 6b 65 74 20 75 70 | 0a 74 6f 20 61 20 6e 75 |ocket up|.to a nu|
|00003a40| 6c 6c 20 28 60 5c 65 30 | 27 29 20 62 79 74 65 2e |ll (`\e0|') byte.|
|00003a50| 20 20 54 68 65 20 72 65 | 73 75 6c 74 61 6e 74 20 | The re|sultant |
|00003a60| 73 74 72 69 6e 67 20 69 | 73 0a 69 6e 74 65 72 70 |string i|s.interp|
|00003a70| 72 65 74 65 64 20 61 73 | 20 61 6e 20 41 53 43 49 |reted as| an ASCI|
|00003a80| 49 20 6e 75 6d 62 65 72 | 2c 20 62 61 73 65 20 31 |I number|, base 1|
|00003a90| 30 2e 0a 2e 49 50 20 33 | 29 0a 49 66 20 74 68 65 |0...IP 3|).If the|
|00003aa0| 20 6e 75 6d 62 65 72 20 | 72 65 63 65 69 76 65 64 | number |received|
|00003ab0| 20 69 6e 20 73 74 65 70 | 20 32 20 69 73 20 6e 6f | in step| 2 is no|
|00003ac0| 6e 2d 7a 65 72 6f 2c 0a | 69 74 20 69 73 20 69 6e |n-zero,.|it is in|
|00003ad0| 74 65 72 70 72 65 74 65 | 64 20 61 73 20 74 68 65 |terprete|d as the|
|00003ae0| 20 70 6f 72 74 20 6e 75 | 6d 62 65 72 20 6f 66 20 | port nu|mber of |
|00003af0| 61 20 73 65 63 6f 6e 64 | 61 72 79 0a 73 74 72 65 |a second|ary.stre|
|00003b00| 61 6d 20 74 6f 20 62 65 | 20 75 73 65 64 20 66 6f |am to be| used fo|
|00003b10| 72 20 74 68 65 20 0a 2e | 42 52 20 73 74 64 65 72 |r the ..|BR stder|
|00003b20| 72 20 2e 0a 41 20 73 65 | 63 6f 6e 64 20 63 6f 6e |r ..A se|cond con|
|00003b30| 6e 65 63 74 69 6f 6e 20 | 69 73 20 74 68 65 6e 20 |nection |is then |
|00003b40| 63 72 65 61 74 65 64 20 | 74 6f 20 74 68 65 20 73 |created |to the s|
|00003b50| 70 65 63 69 66 69 65 64 | 0a 70 6f 72 74 20 6f 6e |pecified|.port on|
|00003b60| 20 74 68 65 20 63 6c 69 | 65 6e 74 27 73 20 6d 61 | the cli|ent's ma|
|00003b70| 63 68 69 6e 65 2e 20 20 | 54 68 65 20 73 6f 75 72 |chine. |The sour|
|00003b80| 63 65 20 70 6f 72 74 20 | 6f 66 20 74 68 69 73 0a |ce port |of this.|
|00003b90| 73 65 63 6f 6e 64 20 63 | 6f 6e 6e 65 63 74 69 6f |second c|onnectio|
|00003ba0| 6e 20 69 73 20 61 6c 73 | 6f 20 69 6e 20 74 68 65 |n is als|o in the|
|00003bb0| 20 72 61 6e 67 65 20 30 | 2d 31 30 32 33 2e 0a 2e | range 0|-1023...|
|00003bc0| 49 50 20 34 29 0a 54 68 | 65 20 73 65 72 76 65 72 |IP 4).Th|e server|
|00003bd0| 20 63 68 65 63 6b 73 20 | 74 68 65 20 63 6c 69 65 | checks |the clie|
|00003be0| 6e 74 27 73 20 73 6f 75 | 72 63 65 20 61 64 64 72 |nt's sou|rce addr|
|00003bf0| 65 73 73 0a 61 6e 64 20 | 72 65 71 75 65 73 74 73 |ess.and |requests|
|00003c00| 20 74 68 65 20 63 6f 72 | 72 65 73 70 6f 6e 64 69 | the cor|respondi|
|00003c10| 6e 67 20 68 6f 73 74 20 | 6e 61 6d 65 20 28 73 65 |ng host |name (se|
|00003c20| 65 0a 2e 49 52 20 67 65 | 74 68 6f 73 74 62 79 61 |e..IR ge|thostbya|
|00003c30| 64 64 72 20 28 33 4e 29 | 2c 0a 2e 49 52 20 68 6f |ddr (3N)|,..IR ho|
|00003c40| 73 74 73 20 28 35 29 0a | 61 6e 64 0a 2e 49 52 20 |sts (5).|and..IR |
|00003c50| 6e 61 6d 65 64 20 28 38 | 29 29 2e 0a 49 66 20 74 |named (8|))..If t|
|00003c60| 68 65 20 68 6f 73 74 6e | 61 6d 65 20 63 61 6e 6e |he hostn|ame cann|
|00003c70| 6f 74 20 62 65 20 64 65 | 74 65 72 6d 69 6e 65 64 |ot be de|termined|
|00003c80| 2c 0a 74 68 65 20 64 6f | 74 2d 6e 6f 74 61 74 69 |,.the do|t-notati|
|00003c90| 6f 6e 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |on repre|sentatio|
|00003ca0| 6e 20 6f 66 20 74 68 65 | 20 68 6f 73 74 20 61 64 |n of the| host ad|
|00003cb0| 64 72 65 73 73 20 69 73 | 20 75 73 65 64 2e 0a 2e |dress is| used...|
|00003cc0| 49 50 20 35 29 0a 41 20 | 6e 75 6c 6c 20 74 65 72 |IP 5).A |null ter|
|00003cd0| 6d 69 6e 61 74 65 64 20 | 75 73 65 72 20 6e 61 6d |minated |user nam|
|00003ce0| 65 20 6f 66 20 61 74 20 | 6d 6f 73 74 20 31 36 20 |e of at |most 16 |
|00003cf0| 63 68 61 72 61 63 74 65 | 72 73 0a 69 73 20 72 65 |characte|rs.is re|
|00003d00| 74 72 69 65 76 65 64 20 | 6f 6e 20 74 68 65 20 69 |trieved |on the i|
|00003d10| 6e 69 74 69 61 6c 20 73 | 6f 63 6b 65 74 2e 20 20 |nitial s|ocket. |
|00003d20| 54 68 69 73 20 75 73 65 | 72 20 6e 61 6d 65 0a 69 |This use|r name.i|
|00003d30| 73 20 69 6e 74 65 72 70 | 72 65 74 65 64 20 61 73 |s interp|reted as|
|00003d40| 20 74 68 65 20 75 73 65 | 72 20 69 64 65 6e 74 69 | the use|r identi|
|00003d50| 74 79 20 6f 6e 20 74 68 | 65 0a 2e 42 52 20 63 6c |ty on th|e..BR cl|
|00003d60| 69 65 6e 74 20 27 73 0a | 6d 61 63 68 69 6e 65 2e |ient 's.|machine.|
|00003d70| 0a 2e 49 50 20 36 29 0a | 41 20 6e 75 6c 6c 20 74 |..IP 6).|A null t|
|00003d80| 65 72 6d 69 6e 61 74 65 | 64 20 75 73 65 72 20 6e |erminate|d user n|
|00003d90| 61 6d 65 20 6f 66 20 61 | 74 20 6d 6f 73 74 20 31 |ame of a|t most 1|
|00003da0| 36 20 63 68 61 72 61 63 | 74 65 72 73 0a 69 73 20 |6 charac|ters.is |
|00003db0| 72 65 74 72 69 65 76 65 | 64 20 6f 6e 20 74 68 65 |retrieve|d on the|
|00003dc0| 20 69 6e 69 74 69 61 6c | 20 73 6f 63 6b 65 74 2e | initial| socket.|
|00003dd0| 20 20 54 68 69 73 20 75 | 73 65 72 20 6e 61 6d 65 | This u|ser name|
|00003de0| 0a 69 73 20 69 6e 74 65 | 72 70 72 65 74 65 64 20 |.is inte|rpreted |
|00003df0| 61 73 20 61 20 75 73 65 | 72 20 69 64 65 6e 74 69 |as a use|r identi|
|00003e00| 74 79 20 74 6f 20 75 73 | 65 20 6f 6e 20 74 68 65 |ty to us|e on the|
|00003e10| 0a 2e 42 52 20 73 65 72 | 76 65 72 20 27 73 0a 6d |..BR ser|ver 's.m|
|00003e20| 61 63 68 69 6e 65 2e 0a | 2e 49 50 20 37 29 0a 41 |achine..|.IP 7).A|
|00003e30| 20 6e 75 6c 6c 20 74 65 | 72 6d 69 6e 61 74 65 64 | null te|rminated|
|00003e40| 20 63 6f 6d 6d 61 6e 64 | 20 74 6f 20 62 65 20 70 | command| to be p|
|00003e50| 61 73 73 65 64 20 74 6f | 20 61 0a 73 68 65 6c 6c |assed to| a.shell|
|00003e60| 20 69 73 20 72 65 74 72 | 69 65 76 65 64 20 6f 6e | is retr|ieved on|
|00003e70| 20 74 68 65 20 69 6e 69 | 74 69 61 6c 20 73 6f 63 | the ini|tial soc|
|00003e80| 6b 65 74 2e 20 20 54 68 | 65 20 6c 65 6e 67 74 68 |ket. Th|e length|
|00003e90| 20 6f 66 0a 74 68 65 20 | 63 6f 6d 6d 61 6e 64 20 | of.the |command |
|00003ea0| 69 73 20 6c 69 6d 69 74 | 65 64 20 62 79 20 74 68 |is limit|ed by th|
|00003eb0| 65 20 75 70 70 65 72 20 | 62 6f 75 6e 64 20 6f 6e |e upper |bound on|
|00003ec0| 20 74 68 65 20 73 69 7a | 65 20 6f 66 0a 74 68 65 | the siz|e of.the|
|00003ed0| 20 73 79 73 74 65 6d 27 | 73 20 61 72 67 75 6d 65 | system'|s argume|
|00003ee0| 6e 74 20 6c 69 73 74 2e | 20 20 0a 2e 49 50 20 38 |nt list.| ..IP 8|
|00003ef0| 29 0a 2e 49 20 52 73 68 | 64 0a 74 68 65 6e 20 76 |)..I Rsh|d.then v|
|00003f00| 61 6c 69 64 61 74 65 73 | 20 74 68 65 20 75 73 65 |alidates| the use|
|00003f10| 72 20 61 63 63 6f 72 64 | 69 6e 67 20 74 6f 20 74 |r accord|ing to t|
|00003f20| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 73 74 65 |he follo|wing ste|
|00003f30| 70 73 2e 0a 54 68 65 20 | 6c 6f 63 61 6c 20 28 73 |ps..The |local (s|
|00003f40| 65 72 76 65 72 2d 65 6e | 64 29 20 75 73 65 72 20 |erver-en|d) user |
|00003f50| 6e 61 6d 65 20 69 73 20 | 6c 6f 6f 6b 65 64 20 75 |name is |looked u|
|00003f60| 70 20 69 6e 20 74 68 65 | 20 70 61 73 73 77 6f 72 |p in the| passwor|
|00003f70| 64 20 66 69 6c 65 0a 61 | 6e 64 20 61 0a 2e 49 20 |d file.a|nd a..I |
|00003f80| 63 68 64 69 72 0a 69 73 | 20 70 65 72 66 6f 72 6d |chdir.is| perform|
|00003f90| 65 64 20 74 6f 20 74 68 | 65 20 75 73 65 72 27 73 |ed to th|e user's|
|00003fa0| 20 68 6f 6d 65 20 64 69 | 72 65 63 74 6f 72 79 2e | home di|rectory.|
|00003fb0| 20 20 49 66 20 65 69 74 | 68 65 72 0a 74 68 65 20 | If eit|her.the |
|00003fc0| 6c 6f 6f 6b 75 70 20 6f | 72 20 0a 2e 49 20 63 68 |lookup o|r ..I ch|
|00003fd0| 64 69 72 0a 66 61 69 6c | 2c 20 74 68 65 20 63 6f |dir.fail|, the co|
|00003fe0| 6e 6e 65 63 74 69 6f 6e | 20 69 73 20 74 65 72 6d |nnection| is term|
|00003ff0| 69 6e 61 74 65 64 2e 0a | 49 66 20 74 68 65 20 75 |inated..|If the u|
|00004000| 73 65 72 20 69 73 20 6e | 6f 74 20 74 68 65 20 73 |ser is n|ot the s|
|00004010| 75 70 65 72 2d 75 73 65 | 72 2c 20 28 75 73 65 72 |uper-use|r, (user|
|00004020| 20 69 64 20 30 29 2c 20 | 74 68 65 20 66 69 6c 65 | id 0), |the file|
|00004030| 20 0a 2e 49 20 2f 65 74 | 63 2f 68 6f 73 74 73 2e | ..I /et|c/hosts.|
|00004040| 65 71 75 69 76 0a 69 73 | 20 63 6f 6e 73 75 6c 74 |equiv.is| consult|
|00004050| 65 64 20 66 6f 72 20 61 | 20 6c 69 73 74 20 6f 66 |ed for a| list of|
|00004060| 20 68 6f 73 74 73 20 63 | 6f 6e 73 69 64 65 72 65 | hosts c|onsidere|
|00004070| 64 20 60 60 65 71 75 69 | 76 61 6c 65 6e 74 27 27 |d ``equi|valent''|
|00004080| 2e 0a 49 66 20 74 68 65 | 20 63 6c 69 65 6e 74 27 |..If the| client'|
|00004090| 73 20 68 6f 73 74 20 6e | 61 6d 65 20 69 73 20 70 |s host n|ame is p|
|000040a0| 72 65 73 65 6e 74 20 69 | 6e 20 74 68 69 73 20 66 |resent i|n this f|
|000040b0| 69 6c 65 2c 20 74 68 65 | 0a 61 75 74 68 65 6e 74 |ile, the|.authent|
|000040c0| 69 63 61 74 69 6f 6e 20 | 69 73 20 63 6f 6e 73 69 |ication |is consi|
|000040d0| 64 65 72 65 64 20 73 75 | 63 63 65 73 73 66 75 6c |dered su|ccessful|
|000040e0| 2e 20 20 49 66 20 74 68 | 65 20 6c 6f 6f 6b 75 70 |. If th|e lookup|
|000040f0| 0a 66 61 69 6c 73 2c 20 | 6f 72 20 74 68 65 20 75 |.fails, |or the u|
|00004100| 73 65 72 20 69 73 20 74 | 68 65 20 73 75 70 65 72 |ser is t|he super|
|00004110| 2d 75 73 65 72 2c 20 74 | 68 65 6e 20 74 68 65 20 |-user, t|hen the |
|00004120| 66 69 6c 65 0a 2e 49 20 | 2e 72 68 6f 73 74 73 0a |file..I |.rhosts.|
|00004130| 69 6e 20 74 68 65 20 68 | 6f 6d 65 20 64 69 72 65 |in the h|ome dire|
|00004140| 63 74 6f 72 79 20 6f 66 | 20 74 68 65 20 72 65 6d |ctory of| the rem|
|00004150| 6f 74 65 20 75 73 65 72 | 20 69 73 20 63 68 65 63 |ote user| is chec|
|00004160| 6b 65 64 20 66 6f 72 0a | 74 68 65 20 6d 61 63 68 |ked for.|the mach|
|00004170| 69 6e 65 20 6e 61 6d 65 | 20 61 6e 64 20 69 64 65 |ine name| and ide|
|00004180| 6e 74 69 74 79 20 6f 66 | 20 74 68 65 20 75 73 65 |ntity of| the use|
|00004190| 72 20 6f 6e 20 74 68 65 | 20 63 6c 69 65 6e 74 27 |r on the| client'|
|000041a0| 73 0a 6d 61 63 68 69 6e | 65 2e 20 20 49 66 20 74 |s.machin|e. If t|
|000041b0| 68 69 73 20 6c 6f 6f 6b | 75 70 20 66 61 69 6c 73 |his look|up fails|
|000041c0| 2c 20 74 68 65 20 63 6f | 6e 6e 65 63 74 69 6f 6e |, the co|nnection|
|000041d0| 20 69 73 20 74 65 72 6d | 69 6e 61 74 65 64 2e 0a | is term|inated..|
|000041e0| 2e 49 50 20 39 29 0a 41 | 20 6e 75 6c 6c 20 62 79 |.IP 9).A| null by|
|000041f0| 74 65 20 69 73 20 72 65 | 74 75 72 6e 65 64 20 6f |te is re|turned o|
|00004200| 6e 20 74 68 65 20 69 6e | 69 74 69 61 6c 20 73 6f |n the in|itial so|
|00004210| 63 6b 65 74 0a 61 6e 64 | 20 74 68 65 20 63 6f 6d |cket.and| the com|
|00004220| 6d 61 6e 64 20 6c 69 6e | 65 20 69 73 20 70 61 73 |mand lin|e is pas|
|00004230| 73 65 64 20 74 6f 20 74 | 68 65 20 6e 6f 72 6d 61 |sed to t|he norma|
|00004240| 6c 20 6c 6f 67 69 6e 0a | 73 68 65 6c 6c 20 6f 66 |l login.|shell of|
|00004250| 20 74 68 65 20 75 73 65 | 72 2e 20 20 54 68 65 0a | the use|r. The.|
|00004260| 73 68 65 6c 6c 20 69 6e | 68 65 72 69 74 73 20 74 |shell in|herits t|
|00004270| 68 65 20 6e 65 74 77 6f | 72 6b 20 63 6f 6e 6e 65 |he netwo|rk conne|
|00004280| 63 74 69 6f 6e 73 20 65 | 73 74 61 62 6c 69 73 68 |ctions e|stablish|
|00004290| 65 64 0a 62 79 0a 2e 49 | 52 20 72 73 68 64 20 2e |ed.by..I|R rshd .|
|000042a0| 0a 2e 53 48 20 44 49 41 | 47 4e 4f 53 54 49 43 53 |..SH DIA|GNOSTICS|
|000042b0| 0a 45 78 63 65 70 74 20 | 66 6f 72 20 74 68 65 20 |.Except |for the |
|000042c0| 6c 61 73 74 20 6f 6e 65 | 20 6c 69 73 74 65 64 20 |last one| listed |
|000042d0| 62 65 6c 6f 77 2c 0a 61 | 6c 6c 20 64 69 61 67 6e |below,.a|ll diagn|
|000042e0| 6f 73 74 69 63 20 6d 65 | 73 73 61 67 65 73 0a 61 |ostic me|ssages.a|
|000042f0| 72 65 20 72 65 74 75 72 | 6e 65 64 20 6f 6e 20 74 |re retur|ned on t|
|00004300| 68 65 20 69 6e 69 74 69 | 61 6c 20 73 6f 63 6b 65 |he initi|al socke|
|00004310| 74 2c 0a 61 66 74 65 72 | 20 77 68 69 63 68 20 61 |t,.after| which a|
|00004320| 6e 79 20 6e 65 74 77 6f | 72 6b 20 63 6f 6e 6e 65 |ny netwo|rk conne|
|00004330| 63 74 69 6f 6e 73 20 61 | 72 65 20 63 6c 6f 73 65 |ctions a|re close|
|00004340| 64 2e 0a 41 6e 20 65 72 | 72 6f 72 20 69 73 20 69 |d..An er|ror is i|
|00004350| 6e 64 69 63 61 74 65 64 | 20 62 79 20 61 20 6c 65 |ndicated| by a le|
|00004360| 61 64 69 6e 67 20 62 79 | 74 65 20 77 69 74 68 20 |ading by|te with |
|00004370| 61 20 76 61 6c 75 65 20 | 6f 66 0a 31 20 28 30 20 |a value |of.1 (0 |
|00004380| 69 73 20 72 65 74 75 72 | 6e 65 64 20 69 6e 20 73 |is retur|ned in s|
|00004390| 74 65 70 20 39 20 61 62 | 6f 76 65 20 75 70 6f 6e |tep 9 ab|ove upon|
|000043a0| 20 73 75 63 63 65 73 73 | 66 75 6c 20 63 6f 6d 70 | success|ful comp|
|000043b0| 6c 65 74 69 6f 6e 0a 6f | 66 20 61 6c 6c 20 74 68 |letion.o|f all th|
|000043c0| 65 20 73 74 65 70 73 20 | 70 72 69 6f 72 20 74 6f |e steps |prior to|
|000043d0| 20 74 68 65 20 65 78 65 | 63 75 74 69 6f 6e 20 6f | the exe|cution o|
|000043e0| 66 20 74 68 65 20 6c 6f | 67 69 6e 20 73 68 65 6c |f the lo|gin shel|
|000043f0| 6c 29 2e 0a 2e 50 50 0a | 2e 42 20 60 60 6c 6f 63 |l)...PP.|.B ``loc|
|00004400| 75 73 65 72 20 74 6f 6f | 20 6c 6f 6e 67 27 27 0a |user too| long''.|
|00004410| 2e 62 72 0a 54 68 65 20 | 6e 61 6d 65 20 6f 66 20 |.br.The |name of |
|00004420| 74 68 65 20 75 73 65 72 | 20 6f 6e 20 74 68 65 20 |the user| on the |
|00004430| 63 6c 69 65 6e 74 27 73 | 20 6d 61 63 68 69 6e 65 |client's| machine|
|00004440| 20 69 73 0a 6c 6f 6e 67 | 65 72 20 74 68 61 6e 20 | is.long|er than |
|00004450| 31 36 20 63 68 61 72 61 | 63 74 65 72 73 2e 0a 2e |16 chara|cters...|
|00004460| 50 50 0a 2e 42 20 60 60 | 72 65 6d 75 73 65 72 20 |PP..B ``|remuser |
|00004470| 74 6f 6f 20 6c 6f 6e 67 | 27 27 0a 2e 62 72 0a 54 |too long|''..br.T|
|00004480| 68 65 20 6e 61 6d 65 20 | 6f 66 20 74 68 65 20 75 |he name |of the u|
|00004490| 73 65 72 20 6f 6e 20 74 | 68 65 20 72 65 6d 6f 74 |ser on t|he remot|
|000044a0| 65 20 6d 61 63 68 69 6e | 65 20 69 73 0a 6c 6f 6e |e machin|e is.lon|
|000044b0| 67 65 72 20 74 68 61 6e | 20 31 36 20 63 68 61 72 |ger than| 16 char|
|000044c0| 61 63 74 65 72 73 2e 0a | 2e 50 50 0a 2e 42 20 60 |acters..|.PP..B `|
|000044d0| 60 63 6f 6d 6d 61 6e 64 | 20 74 6f 6f 20 6c 6f 6e |`command| too lon|
|000044e0| 67 20 27 27 0a 2e 62 72 | 0a 54 68 65 20 63 6f 6d |g ''..br|.The com|
|000044f0| 6d 61 6e 64 20 6c 69 6e | 65 20 70 61 73 73 65 64 |mand lin|e passed|
|00004500| 20 65 78 63 65 65 64 73 | 20 74 68 65 20 73 69 7a | exceeds| the siz|
|00004510| 65 20 6f 66 20 74 68 65 | 20 61 72 67 75 6d 65 6e |e of the| argumen|
|00004520| 74 0a 6c 69 73 74 20 28 | 61 73 20 63 6f 6e 66 69 |t.list (|as confi|
|00004530| 67 75 72 65 64 20 69 6e | 74 6f 20 74 68 65 20 73 |gured in|to the s|
|00004540| 79 73 74 65 6d 29 2e 0a | 2e 50 50 0a 2e 42 20 60 |ystem)..|.PP..B `|
|00004550| 60 4c 6f 67 69 6e 20 69 | 6e 63 6f 72 72 65 63 74 |`Login i|ncorrect|
|00004560| 2e 27 27 0a 2e 62 72 0a | 4e 6f 20 70 61 73 73 77 |.''..br.|No passw|
|00004570| 6f 72 64 20 66 69 6c 65 | 20 65 6e 74 72 79 20 66 |ord file| entry f|
|00004580| 6f 72 20 74 68 65 20 75 | 73 65 72 20 6e 61 6d 65 |or the u|ser name|
|00004590| 20 65 78 69 73 74 65 64 | 2e 0a 2e 50 50 0a 2e 42 | existed|...PP..B|
|000045a0| 20 60 60 4e 6f 20 72 65 | 6d 6f 74 65 20 64 69 72 | ``No re|mote dir|
|000045b0| 65 63 74 6f 72 79 2e 27 | 27 0a 2e 62 72 0a 54 68 |ectory.'|'..br.Th|
|000045c0| 65 20 0a 2e 49 20 63 68 | 64 69 72 0a 63 6f 6d 6d |e ..I ch|dir.comm|
|000045d0| 61 6e 64 20 74 6f 20 74 | 68 65 20 68 6f 6d 65 20 |and to t|he home |
|000045e0| 64 69 72 65 63 74 6f 72 | 79 20 66 61 69 6c 65 64 |director|y failed|
|000045f0| 2e 0a 2e 50 50 0a 2e 42 | 20 60 60 50 65 72 6d 69 |...PP..B| ``Permi|
|00004600| 73 73 69 6f 6e 20 64 65 | 6e 69 65 64 2e 27 27 0a |ssion de|nied.''.|
|00004610| 2e 62 72 0a 54 68 65 20 | 61 75 74 68 65 6e 74 69 |.br.The |authenti|
|00004620| 63 61 74 69 6f 6e 20 70 | 72 6f 63 65 64 75 72 65 |cation p|rocedure|
|00004630| 20 64 65 73 63 72 69 62 | 65 64 20 61 62 6f 76 65 | describ|ed above|
|00004640| 20 66 61 69 6c 65 64 2e | 0a 2e 50 50 0a 2e 42 20 | failed.|..PP..B |
|00004650| 60 60 43 61 6e 27 74 20 | 6d 61 6b 65 20 70 69 70 |``Can't |make pip|
|00004660| 65 2e 27 27 0a 2e 62 72 | 0a 54 68 65 20 70 69 70 |e.''..br|.The pip|
|00004670| 65 20 6e 65 65 64 65 64 | 20 66 6f 72 20 74 68 65 |e needed| for the|
|00004680| 20 0a 2e 42 52 20 73 74 | 64 65 72 72 20 2c 0a 77 | ..BR st|derr ,.w|
|00004690| 61 73 6e 27 74 20 63 72 | 65 61 74 65 64 2e 0a 2e |asn't cr|eated...|
|000046a0| 50 50 0a 2e 42 20 60 60 | 54 72 79 20 61 67 61 69 |PP..B ``|Try agai|
|000046b0| 6e 2e 27 27 0a 2e 62 72 | 0a 41 0a 2e 49 20 66 6f |n.''..br|.A..I fo|
|000046c0| 72 6b 0a 62 79 20 74 68 | 65 20 73 65 72 76 65 72 |rk.by th|e server|
|000046d0| 20 66 61 69 6c 65 64 2e | 0a 2e 50 50 0a 2e 42 20 | failed.|..PP..B |
|000046e0| 60 60 3c 73 68 65 6c 6c | 6e 61 6d 65 3e 3a 20 2e |``<shell|name>: .|
|000046f0| 2e 2e 27 27 0a 2e 62 72 | 0a 54 68 65 20 75 73 65 |..''..br|.The use|
|00004700| 72 27 73 20 6c 6f 67 69 | 6e 20 73 68 65 6c 6c 20 |r's logi|n shell |
|00004710| 63 6f 75 6c 64 20 6e 6f | 74 20 62 65 20 73 74 61 |could no|t be sta|
|00004720| 72 74 65 64 2e 20 20 54 | 68 69 73 20 6d 65 73 73 |rted. T|his mess|
|00004730| 61 67 65 20 69 73 20 72 | 65 74 75 72 6e 65 64 0a |age is r|eturned.|
|00004740| 6f 6e 20 74 68 65 20 63 | 6f 6e 6e 65 63 74 69 6f |on the c|onnectio|
|00004750| 6e 20 61 73 73 6f 63 69 | 61 74 65 64 20 77 69 74 |n associ|ated wit|
|00004760| 68 20 74 68 65 0a 2e 42 | 52 20 73 74 64 65 72 72 |h the..B|R stderr|
|00004770| 20 2c 0a 61 6e 64 20 69 | 73 20 6e 6f 74 20 70 72 | ,.and i|s not pr|
|00004780| 65 63 65 64 65 64 20 62 | 79 20 61 20 66 6c 61 67 |eceded b|y a flag|
|00004790| 20 62 79 74 65 2e 0a 2e | 53 48 20 53 45 45 20 41 | byte...|SH SEE A|
|000047a0| 4c 53 4f 0a 72 73 68 28 | 31 29 2c 20 72 63 6d 64 |LSO.rsh(|1), rcmd|
|000047b0| 28 33 29 0a 2e 53 48 20 | 42 55 47 53 0a 54 68 65 |(3)..SH |BUGS.The|
|000047c0| 20 61 75 74 68 65 6e 74 | 69 63 61 74 69 6f 6e 20 | authent|ication |
|000047d0| 70 72 6f 63 65 64 75 72 | 65 20 75 73 65 64 20 68 |procedur|e used h|
|000047e0| 65 72 65 20 61 73 73 75 | 6d 65 73 20 74 68 65 20 |ere assu|mes the |
|000047f0| 69 6e 74 65 67 72 69 74 | 79 0a 6f 66 20 65 61 63 |integrit|y.of eac|
|00004800| 68 20 63 6c 69 65 6e 74 | 20 6d 61 63 68 69 6e 65 |h client| machine|
|00004810| 20 61 6e 64 20 74 68 65 | 20 63 6f 6e 6e 65 63 74 | and the| connect|
|00004820| 69 6e 67 20 6d 65 64 69 | 75 6d 2e 20 20 54 68 69 |ing medi|um. Thi|
|00004830| 73 20 69 73 0a 69 6e 73 | 65 63 75 72 65 2c 20 62 |s is.ins|ecure, b|
|00004840| 75 74 20 69 73 20 75 73 | 65 66 75 6c 20 69 6e 20 |ut is us|eful in |
|00004850| 61 6e 20 60 60 6f 70 65 | 6e 27 27 20 65 6e 76 69 |an ``ope|n'' envi|
|00004860| 72 6f 6e 6d 65 6e 74 2e | 0a 2e 50 50 0a 41 20 66 |ronment.|..PP.A f|
|00004870| 61 63 69 6c 69 74 79 20 | 74 6f 20 61 6c 6c 6f 77 |acility |to allow|
|00004880| 20 61 6c 6c 20 64 61 74 | 61 20 65 78 63 68 61 6e | all dat|a exchan|
|00004890| 67 65 73 20 74 6f 20 62 | 65 20 65 6e 63 72 79 70 |ges to b|e encryp|
|000048a0| 74 65 64 20 73 68 6f 75 | 6c 64 20 62 65 0a 70 72 |ted shou|ld be.pr|
|000048b0| 65 73 65 6e 74 2e 0a 2e | 50 50 0a 41 20 6d 6f 72 |esent...|PP.A mor|
|000048c0| 65 20 65 78 74 65 6e 73 | 69 62 6c 65 20 70 72 6f |e extens|ible pro|
|000048d0| 74 6f 63 6f 6c 20 73 68 | 6f 75 6c 64 20 62 65 20 |tocol sh|ould be |
|000048e0| 75 73 65 64 2e 0a 74 20 | 6d 6f 73 74 20 31 36 20 |used..t |most 16 |
|000048f0| 63 68 61 72 61 63 74 65 | 72 73 0a 69 73 20 72 65 |characte|rs.is re|
|00004900| 74 72 69 65 76 65 64 20 | 6f 6e 20 74 68 65 20 69 |trieved |on the i|
|00004910| 6e 69 74 69 61 6c 20 73 | 6f 63 6b 65 74 2e 20 20 |nitial s|ocket. |
|00004920| 54 68 69 73 20 75 73 65 | 72 20 6e 61 6d 65 0a 69 |This use|r name.i|
|00004930| 73 20 69 6e 74 65 72 70 | 72 65 74 65 64 20 61 73 |s interp|reted as|
|00004940| 20 74 68 65 20 75 73 65 | 72 20 69 64 65 6e 74 69 | the use|r identi|
|00004950| 74 79 20 6f 6e 20 74 68 | 65 0a 2e 42 52 20 63 6c |ty on th|e..BR cl|
|00004960| 69 65 6e 74 20 27 73 0a | 6d 61 63 68 69 6e 65 2e |ient 's.|machine.|
|00004970| 0a 2e 49 50 20 36 29 0a | 41 20 6e 75 6c 6c 20 74 |..IP 6).|A null t|
|00004980| 65 72 6d 69 6e 61 74 65 | 64 20 75 73 65 72 20 6e |erminate|d user n|
|00004990| 61 6d 65 20 6f 66 20 61 | 74 20 6d 6f 73 74 20 31 |ame of a|t most 1|
|000049a0| 36 20 63 68 61 72 61 63 | 74 65 72 73 0a 69 73 20 |6 charac|ters.is |
|000049b0| 72 65 74 72 69 65 76 65 | 64 20 6f 6e 20 74 68 65 |retrieve|d on the|
|000049c0| 20 69 6e 69 74 69 61 6c | 20 73 6f 63 6b 65 74 2e | initial| socket.|
|000049d0| 20 20 54 68 69 73 20 75 | 73 65 72 20 6e 61 6d 65 | This u|ser name|
|000049e0| 0a 69 73 20 69 6e 74 65 | 72 70 72 65 74 65 64 20 |.is inte|rpreted |
|000049f0| 61 73 20 61 20 75 73 65 | 72 20 69 64 65 6e 74 69 |as a use|r identi|
|00004a00| 6c 6f 67 64 61 65 6d 6f | 6e 2d 32 2f 72 73 68 64 |logdaemo|n-2/rshd|
|00004a10| 2f 4d 61 6b 65 66 69 6c | 65 00 00 00 00 00 00 00 |/Makefil|e.......|
|00004a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 34 |.... 6|44 . 4|
|00004a70| 36 35 20 00 20 20 20 35 | 30 36 20 00 20 20 20 20 |65 . 5|06 . |
|00004a80| 20 20 20 32 32 37 31 20 | 20 35 33 35 36 33 37 31 | 2271 | 5356371|
|00004a90| 36 37 37 20 20 31 30 36 | 37 30 00 20 00 00 00 00 |677 106|70. ....|
|00004aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004c00| 23 0a 23 20 43 6f 70 79 | 72 69 67 68 74 20 28 63 |#.# Copy|right (c|
|00004c10| 29 20 31 39 38 38 20 52 | 65 67 65 6e 74 73 20 6f |) 1988 R|egents o|
|00004c20| 66 20 74 68 65 20 55 6e | 69 76 65 72 73 69 74 79 |f the Un|iversity|
|00004c30| 20 6f 66 20 43 61 6c 69 | 66 6f 72 6e 69 61 2e 0a | of Cali|fornia..|
|00004c40| 23 20 41 6c 6c 20 72 69 | 67 68 74 73 20 72 65 73 |# All ri|ghts res|
|00004c50| 65 72 76 65 64 2e 0a 23 | 0a 23 20 52 65 64 69 73 |erved..#|.# Redis|
|00004c60| 74 72 69 62 75 74 69 6f | 6e 20 61 6e 64 20 75 73 |tributio|n and us|
|00004c70| 65 20 69 6e 20 73 6f 75 | 72 63 65 20 61 6e 64 20 |e in sou|rce and |
|00004c80| 62 69 6e 61 72 79 20 66 | 6f 72 6d 73 20 61 72 65 |binary f|orms are|
|00004c90| 20 70 65 72 6d 69 74 74 | 65 64 0a 23 20 70 72 6f | permitt|ed.# pro|
|00004ca0| 76 69 64 65 64 20 74 68 | 61 74 20 74 68 65 20 61 |vided th|at the a|
|00004cb0| 62 6f 76 65 20 63 6f 70 | 79 72 69 67 68 74 20 6e |bove cop|yright n|
|00004cc0| 6f 74 69 63 65 20 61 6e | 64 20 74 68 69 73 20 70 |otice an|d this p|
|00004cd0| 61 72 61 67 72 61 70 68 | 20 61 72 65 0a 23 20 64 |aragraph| are.# d|
|00004ce0| 75 70 6c 69 63 61 74 65 | 64 20 69 6e 20 61 6c 6c |uplicate|d in all|
|00004cf0| 20 73 75 63 68 20 66 6f | 72 6d 73 20 61 6e 64 20 | such fo|rms and |
|00004d00| 74 68 61 74 20 61 6e 79 | 20 64 6f 63 75 6d 65 6e |that any| documen|
|00004d10| 74 61 74 69 6f 6e 2c 20 | 61 64 76 65 72 74 69 73 |tation, |advertis|
|00004d20| 69 6e 67 0a 23 20 6d 61 | 74 65 72 69 61 6c 73 2c |ing.# ma|terials,|
|00004d30| 20 61 6e 64 20 6f 74 68 | 65 72 20 6d 61 74 65 72 | and oth|er mater|
|00004d40| 69 61 6c 73 20 72 65 6c | 61 74 65 64 20 74 6f 20 |ials rel|ated to |
|00004d50| 73 75 63 68 20 72 65 64 | 69 73 74 72 69 62 75 74 |such red|istribut|
|00004d60| 69 6f 6e 20 61 6e 64 0a | 23 20 75 73 65 20 61 63 |ion and.|# use ac|
|00004d70| 6b 6e 6f 77 6c 65 64 67 | 65 20 74 68 61 74 20 74 |knowledg|e that t|
|00004d80| 68 65 20 73 6f 66 74 77 | 61 72 65 20 77 61 73 20 |he softw|are was |
|00004d90| 64 65 76 65 6c 6f 70 65 | 64 20 62 79 20 74 68 65 |develope|d by the|
|00004da0| 20 55 6e 69 76 65 72 73 | 69 74 79 0a 23 20 6f 66 | Univers|ity.# of|
|00004db0| 20 43 61 6c 69 66 6f 72 | 6e 69 61 2c 20 42 65 72 | Califor|nia, Ber|
|00004dc0| 6b 65 6c 65 79 2e 20 20 | 54 68 65 20 6e 61 6d 65 |keley. |The name|
|00004dd0| 20 6f 66 20 74 68 65 20 | 55 6e 69 76 65 72 73 69 | of the |Universi|
|00004de0| 74 79 20 6d 61 79 20 6e | 6f 74 20 62 65 0a 23 20 |ty may n|ot be.# |
|00004df0| 75 73 65 64 20 74 6f 20 | 65 6e 64 6f 72 73 65 20 |used to |endorse |
|00004e00| 6f 72 20 70 72 6f 6d 6f | 74 65 20 70 72 6f 64 75 |or promo|te produ|
|00004e10| 63 74 73 20 64 65 72 69 | 76 65 64 20 66 72 6f 6d |cts deri|ved from|
|00004e20| 20 74 68 69 73 20 73 6f | 66 74 77 61 72 65 0a 23 | this so|ftware.#|
|00004e30| 20 77 69 74 68 6f 75 74 | 20 73 70 65 63 69 66 69 | without| specifi|
|00004e40| 63 20 70 72 69 6f 72 20 | 77 72 69 74 74 65 6e 20 |c prior |written |
|00004e50| 70 65 72 6d 69 73 73 69 | 6f 6e 2e 20 20 54 48 49 |permissi|on. THI|
|00004e60| 53 20 53 4f 46 54 57 41 | 52 45 20 49 53 20 50 52 |S SOFTWA|RE IS PR|
|00004e70| 4f 56 49 44 45 44 0a 23 | 20 60 60 41 53 20 49 53 |OVIDED.#| ``AS IS|
|00004e80| 27 27 20 41 4e 44 20 57 | 49 54 48 4f 55 54 20 41 |'' AND W|ITHOUT A|
|00004e90| 4e 59 20 45 58 50 52 45 | 53 53 20 4f 52 20 49 4d |NY EXPRE|SS OR IM|
|00004ea0| 50 4c 49 45 44 20 57 41 | 52 52 41 4e 54 49 45 53 |PLIED WA|RRANTIES|
|00004eb0| 2c 20 49 4e 43 4c 55 44 | 49 4e 47 2c 0a 23 20 57 |, INCLUD|ING,.# W|
|00004ec0| 49 54 48 4f 55 54 20 4c | 49 4d 49 54 41 54 49 4f |ITHOUT L|IMITATIO|
|00004ed0| 4e 2c 20 54 48 45 20 49 | 4d 50 4c 49 45 44 20 57 |N, THE I|MPLIED W|
|00004ee0| 41 52 52 41 4e 54 49 45 | 53 20 4f 46 20 4d 45 52 |ARRANTIE|S OF MER|
|00004ef0| 43 48 41 4e 54 49 42 49 | 4c 49 54 59 20 41 4e 44 |CHANTIBI|LITY AND|
|00004f00| 0a 23 20 46 49 54 4e 45 | 53 53 20 46 4f 52 20 41 |.# FITNE|SS FOR A|
|00004f10| 20 50 41 52 54 49 43 55 | 4c 41 52 20 50 55 52 50 | PARTICU|LAR PURP|
|00004f20| 4f 53 45 2e 0a 23 0a 23 | 20 40 28 23 29 4d 61 6b |OSE..#.#| @(#)Mak|
|00004f30| 65 66 69 6c 65 09 35 2e | 31 20 28 42 65 72 6b 65 |efile.5.|1 (Berke|
|00004f40| 6c 65 79 29 20 39 2f 31 | 39 2f 38 38 0a 23 0a 0a |ley) 9/1|9/88.#..|
|00004f50| 4c 49 42 53 09 3d 20 24 | 28 4c 4f 47 5f 54 43 50 |LIBS.= $|(LOG_TCP|
|00004f60| 29 2f 6c 69 62 77 72 61 | 70 2e 61 0a 53 52 43 53 |)/libwra|p.a.SRCS|
|00004f70| 09 3d 20 72 73 68 64 2e | 63 0a 53 48 45 4c 4c 09 |.= rshd.|c.SHELL.|
|00004f80| 3d 20 2f 62 69 6e 2f 73 | 68 0a 0a 77 68 61 74 3a |= /bin/s|h..what:|
|00004f90| 0a 09 40 65 63 68 6f 20 | 6d 61 6b 65 20 73 75 6e |..@echo |make sun|
|00004fa0| 6f 73 34 20 73 75 6e 6f | 73 35 20 6f 72 20 75 6c |os4 suno|s5 or ul|
|00004fb0| 74 72 69 78 34 20 31 3e | 26 32 3b 20 65 78 69 74 |trix4 1>|&2; exit|
|00004fc0| 20 31 0a 0a 73 75 6e 6f | 73 35 3a 0a 09 6d 61 6b | 1..suno|s5:..mak|
|00004fd0| 65 20 43 46 4c 41 47 53 | 3d 22 2d 4f 20 2d 44 55 |e CFLAGS|="-O -DU|
|00004fe0| 53 45 5f 53 54 52 49 4e | 47 5f 48 20 2d 44 5f 5f |SE_STRIN|G_H -D__|
|00004ff0| 73 76 72 34 5f 5f 22 20 | 53 59 53 4c 49 42 53 3d |svr4__" |SYSLIBS=|
|00005000| 22 2d 6c 73 6f 63 6b 65 | 74 20 2d 6c 6e 73 6c 22 |"-lsocke|t -lnsl"|
|00005010| 20 72 73 68 64 0a 0a 73 | 75 6e 6f 73 34 20 75 6c | rshd..s|unos4 ul|
|00005020| 74 72 69 78 34 3a 20 0a | 09 6d 61 6b 65 20 43 46 |trix4: .|.make CF|
|00005030| 4c 41 47 53 3d 22 2d 4f | 22 20 53 59 53 4c 49 42 |LAGS="-O|" SYSLIB|
|00005040| 53 3d 20 72 73 68 64 0a | 0a 61 6c 6c 3a 20 72 73 |S= rshd.|.all: rs|
|00005050| 68 64 0a 0a 72 73 68 64 | 3a 20 72 73 68 64 2e 63 |hd..rshd|: rshd.c|
|00005060| 20 24 7b 4c 49 42 53 7d | 0a 09 24 7b 43 43 7d 20 | ${LIBS}|..${CC} |
|00005070| 2d 6f 20 24 40 20 24 7b | 43 46 4c 41 47 53 7d 20 |-o $@ ${|CFLAGS} |
|00005080| 24 40 2e 63 20 24 7b 4c | 49 42 53 7d 20 24 7b 53 |$@.c ${L|IBS} ${S|
|00005090| 59 53 4c 49 42 53 7d 0a | 0a 63 6c 65 61 6e 3a 0a |YSLIBS}.|.clean:.|
|000050a0| 09 72 6d 20 2d 66 20 24 | 7b 4f 42 4a 53 7d 20 63 |.rm -f $|{OBJS} c|
|000050b0| 6f 72 65 20 72 73 68 64 | 0a 72 69 67 68 74 20 6e |ore rshd|.right n|
|000050c0| 6f 74 69 63 65 20 61 6e | 64 20 74 68 69 73 20 70 |otice an|d this p|
|000050d0| 61 72 61 67 72 61 70 68 | 20 61 72 65 0a 23 20 64 |aragraph| are.# d|
|000050e0| 75 70 6c 69 63 61 74 65 | 64 20 69 6e 20 61 6c 6c |uplicate|d in all|
|000050f0| 20 73 75 63 68 20 66 6f | 72 6d 73 20 61 6e 64 20 | such fo|rms and |
|00005100| 74 68 61 74 20 61 6e 79 | 20 64 6f 63 75 6d 65 6e |that any| documen|
|00005110| 74 61 74 69 6f 6e 2c 20 | 61 64 76 65 72 74 69 73 |tation, |advertis|
|00005120| 69 6e 67 0a 23 20 6d 61 | 74 65 72 69 61 6c 73 2c |ing.# ma|terials,|
|00005130| 20 61 6e 64 20 6f 74 68 | 65 72 20 6d 61 74 65 72 | and oth|er mater|
|00005140| 69 61 6c 73 20 72 65 6c | 61 74 65 64 20 74 6f 20 |ials rel|ated to |
|00005150| 73 75 63 68 20 72 65 64 | 69 73 74 72 69 62 75 74 |such red|istribut|
|00005160| 69 6f 6e 20 61 6e 64 0a | 23 20 75 73 65 20 61 63 |ion and.|# use ac|
|00005170| 6b 6e 6f 77 6c 65 64 67 | 65 20 74 68 61 74 20 74 |knowledg|e that t|
|00005180| 68 65 20 73 6f 66 74 77 | 61 72 65 20 77 61 73 20 |he softw|are was |
|00005190| 64 65 76 65 6c 6f 70 65 | 64 20 62 79 20 74 68 65 |develope|d by the|
|000051a0| 20 55 6e 69 76 65 72 73 | 69 74 79 0a 23 20 6f 66 | Univers|ity.# of|
|000051b0| 20 43 61 6c 69 66 6f 72 | 6e 69 61 2c 20 42 65 72 | Califor|nia, Ber|
|000051c0| 6b 65 6c 65 79 2e 20 20 | 54 68 65 20 6e 61 6d 65 |keley. |The name|
|000051d0| 20 6f 66 20 74 68 65 20 | 55 6e 69 76 65 72 73 69 | of the |Universi|
|000051e0| 74 79 20 6d 61 79 20 6e | 6f 74 20 62 65 0a 23 20 |ty may n|ot be.# |
|000051f0| 75 73 65 64 20 74 6f 20 | 65 6e 64 6f 72 73 65 20 |used to |endorse |
|00005200| 6c 6f 67 64 61 65 6d 6f | 6e 2d 32 2f 72 73 68 64 |logdaemo|n-2/rshd|
|00005210| 2f 72 73 68 64 2e 63 2d | 00 00 00 00 00 00 00 00 |/rshd.c-|........|
|00005220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005260| 00 00 00 00 20 20 20 34 | 34 34 20 00 20 20 20 34 |.... 4|44 . 4|
|00005270| 36 35 20 00 20 20 20 35 | 30 36 20 00 20 20 20 20 |65 . 5|06 . |
|00005280| 20 20 32 32 34 32 36 20 | 20 34 33 37 33 37 30 34 | 22426 | 4373704|
|00005290| 33 30 35 20 20 31 30 34 | 31 35 00 20 00 00 00 00 |305 104|15. ....|
|000052a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005400| 2f 2a 0a 20 2a 20 43 6f | 70 79 72 69 67 68 74 20 |/*. * Co|pyright |
|00005410| 28 63 29 20 31 39 38 33 | 2c 20 31 39 38 38 20 54 |(c) 1983|, 1988 T|
|00005420| 68 65 20 52 65 67 65 6e | 74 73 20 6f 66 20 74 68 |he Regen|ts of th|
|00005430| 65 20 55 6e 69 76 65 72 | 73 69 74 79 20 6f 66 20 |e Univer|sity of |
|00005440| 43 61 6c 69 66 6f 72 6e | 69 61 2e 0a 20 2a 20 41 |Californ|ia.. * A|
|00005450| 6c 6c 20 72 69 67 68 74 | 73 20 72 65 73 65 72 76 |ll right|s reserv|
|00005460| 65 64 2e 0a 20 2a 0a 20 | 2a 20 52 65 64 69 73 74 |ed.. *. |* Redist|
|00005470| 72 69 62 75 74 69 6f 6e | 20 61 6e 64 20 75 73 65 |ribution| and use|
|00005480| 20 69 6e 20 73 6f 75 72 | 63 65 20 61 6e 64 20 62 | in sour|ce and b|
|00005490| 69 6e 61 72 79 20 66 6f | 72 6d 73 20 61 72 65 20 |inary fo|rms are |
|000054a0| 70 65 72 6d 69 74 74 65 | 64 0a 20 2a 20 70 72 6f |permitte|d. * pro|
|000054b0| 76 69 64 65 64 20 74 68 | 61 74 20 74 68 65 20 61 |vided th|at the a|
|000054c0| 62 6f 76 65 20 63 6f 70 | 79 72 69 67 68 74 20 6e |bove cop|yright n|
|000054d0| 6f 74 69 63 65 20 61 6e | 64 20 74 68 69 73 20 70 |otice an|d this p|
|000054e0| 61 72 61 67 72 61 70 68 | 20 61 72 65 0a 20 2a 20 |aragraph| are. * |
|000054f0| 64 75 70 6c 69 63 61 74 | 65 64 20 69 6e 20 61 6c |duplicat|ed in al|
|00005500| 6c 20 73 75 63 68 20 66 | 6f 72 6d 73 20 61 6e 64 |l such f|orms and|
|00005510| 20 74 68 61 74 20 61 6e | 79 20 64 6f 63 75 6d 65 | that an|y docume|
|00005520| 6e 74 61 74 69 6f 6e 2c | 0a 20 2a 20 61 64 76 65 |ntation,|. * adve|
|00005530| 72 74 69 73 69 6e 67 20 | 6d 61 74 65 72 69 61 6c |rtising |material|
|00005540| 73 2c 20 61 6e 64 20 6f | 74 68 65 72 20 6d 61 74 |s, and o|ther mat|
|00005550| 65 72 69 61 6c 73 20 72 | 65 6c 61 74 65 64 20 74 |erials r|elated t|
|00005560| 6f 20 73 75 63 68 0a 20 | 2a 20 64 69 73 74 72 69 |o such. |* distri|
|00005570| 62 75 74 69 6f 6e 20 61 | 6e 64 20 75 73 65 20 61 |bution a|nd use a|
|00005580| 63 6b 6e 6f 77 6c 65 64 | 67 65 20 74 68 61 74 20 |cknowled|ge that |
|00005590| 74 68 65 20 73 6f 66 74 | 77 61 72 65 20 77 61 73 |the soft|ware was|
|000055a0| 20 64 65 76 65 6c 6f 70 | 65 64 0a 20 2a 20 62 79 | develop|ed. * by|
|000055b0| 20 74 68 65 20 55 6e 69 | 76 65 72 73 69 74 79 20 | the Uni|versity |
|000055c0| 6f 66 20 43 61 6c 69 66 | 6f 72 6e 69 61 2c 20 42 |of Calif|ornia, B|
|000055d0| 65 72 6b 65 6c 65 79 2e | 20 20 54 68 65 20 6e 61 |erkeley.| The na|
|000055e0| 6d 65 20 6f 66 20 74 68 | 65 0a 20 2a 20 55 6e 69 |me of th|e. * Uni|
|000055f0| 76 65 72 73 69 74 79 20 | 6d 61 79 20 6e 6f 74 20 |versity |may not |
|00005600| 62 65 20 75 73 65 64 20 | 74 6f 20 65 6e 64 6f 72 |be used |to endor|
|00005610| 73 65 20 6f 72 20 70 72 | 6f 6d 6f 74 65 20 70 72 |se or pr|omote pr|
|00005620| 6f 64 75 63 74 73 20 64 | 65 72 69 76 65 64 0a 20 |oducts d|erived. |
|00005630| 2a 20 66 72 6f 6d 20 74 | 68 69 73 20 73 6f 66 74 |* from t|his soft|
|00005640| 77 61 72 65 20 77 69 74 | 68 6f 75 74 20 73 70 65 |ware wit|hout spe|
|00005650| 63 69 66 69 63 20 70 72 | 69 6f 72 20 77 72 69 74 |cific pr|ior writ|
|00005660| 74 65 6e 20 70 65 72 6d | 69 73 73 69 6f 6e 2e 0a |ten perm|ission..|
|00005670| 20 2a 20 54 48 49 53 20 | 53 4f 46 54 57 41 52 45 | * THIS |SOFTWARE|
|00005680| 20 49 53 20 50 52 4f 56 | 49 44 45 44 20 60 60 41 | IS PROV|IDED ``A|
|00005690| 53 20 49 53 27 27 20 41 | 4e 44 20 57 49 54 48 4f |S IS'' A|ND WITHO|
|000056a0| 55 54 20 41 4e 59 20 45 | 58 50 52 45 53 53 20 4f |UT ANY E|XPRESS O|
|000056b0| 52 0a 20 2a 20 49 4d 50 | 4c 49 45 44 20 57 41 52 |R. * IMP|LIED WAR|
|000056c0| 52 41 4e 54 49 45 53 2c | 20 49 4e 43 4c 55 44 49 |RANTIES,| INCLUDI|
|000056d0| 4e 47 2c 20 57 49 54 48 | 4f 55 54 20 4c 49 4d 49 |NG, WITH|OUT LIMI|
|000056e0| 54 41 54 49 4f 4e 2c 20 | 54 48 45 20 49 4d 50 4c |TATION, |THE IMPL|
|000056f0| 49 45 44 0a 20 2a 20 57 | 41 52 52 41 4e 54 49 45 |IED. * W|ARRANTIE|
|00005700| 53 20 4f 46 20 4d 45 52 | 43 48 41 4e 54 49 42 49 |S OF MER|CHANTIBI|
|00005710| 4c 49 54 59 20 41 4e 44 | 20 46 49 54 4e 45 53 53 |LITY AND| FITNESS|
|00005720| 20 46 4f 52 20 41 20 50 | 41 52 54 49 43 55 4c 41 | FOR A P|ARTICULA|
|00005730| 52 20 50 55 52 50 4f 53 | 45 2e 0a 20 2a 2f 0a 0a |R PURPOS|E.. */..|
|00005740| 23 69 66 6e 64 65 66 20 | 6c 69 6e 74 0a 63 68 61 |#ifndef |lint.cha|
|00005750| 72 20 63 6f 70 79 72 69 | 67 68 74 5b 5d 20 3d 0a |r copyri|ght[] =.|
|00005760| 22 40 28 23 29 20 43 6f | 70 79 72 69 67 68 74 20 |"@(#) Co|pyright |
|00005770| 28 63 29 20 31 39 38 33 | 2c 20 31 39 38 38 20 54 |(c) 1983|, 1988 T|
|00005780| 68 65 20 52 65 67 65 6e | 74 73 20 6f 66 20 74 68 |he Regen|ts of th|
|00005790| 65 20 55 6e 69 76 65 72 | 73 69 74 79 20 6f 66 20 |e Univer|sity of |
|000057a0| 43 61 6c 69 66 6f 72 6e | 69 61 2e 5c 6e 5c 0a 20 |Californ|ia.\n\. |
|000057b0| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|000057c0| 76 65 64 2e 5c 6e 22 3b | 0a 23 65 6e 64 69 66 20 |ved.\n";|.#endif |
|000057d0| 2f 2a 20 6e 6f 74 20 6c | 69 6e 74 20 2a 2f 0a 0a |/* not l|int */..|
|000057e0| 23 69 66 6e 64 65 66 20 | 6c 69 6e 74 0a 73 74 61 |#ifndef |lint.sta|
|000057f0| 74 69 63 20 63 68 61 72 | 20 73 63 63 73 69 64 5b |tic char| sccsid[|
|00005800| 5d 20 3d 20 22 40 28 23 | 29 72 73 68 64 2e 63 09 |] = "@(#|)rshd.c.|
|00005810| 35 2e 31 37 2e 31 2e 32 | 20 28 42 65 72 6b 65 6c |5.17.1.2| (Berkel|
|00005820| 65 79 29 20 32 2f 37 2f | 38 39 22 3b 0a 23 65 6e |ey) 2/7/|89";.#en|
|00005830| 64 69 66 20 2f 2a 20 6e | 6f 74 20 6c 69 6e 74 20 |dif /* n|ot lint |
|00005840| 2a 2f 0a 0a 2f 2a 0a 20 | 2a 20 72 65 6d 6f 74 65 |*/../*. |* remote|
|00005850| 20 73 68 65 6c 6c 20 73 | 65 72 76 65 72 3a 0a 20 | shell s|erver:. |
|00005860| 2a 09 5b 70 6f 72 74 5d | 5c 30 0a 20 2a 09 72 65 |*.[port]|\0. *.re|
|00005870| 6d 75 73 65 72 5c 30 0a | 20 2a 09 6c 6f 63 75 73 |muser\0.| *.locus|
|00005880| 65 72 5c 30 0a 20 2a 09 | 63 6f 6d 6d 61 6e 64 5c |er\0. *.|command\|
|00005890| 30 0a 20 2a 09 64 61 74 | 61 0a 20 2a 2f 0a 23 69 |0. *.dat|a. */.#i|
|000058a0| 6e 63 6c 75 64 65 20 3c | 73 79 73 2f 70 61 72 61 |nclude <|sys/para|
|000058b0| 6d 2e 68 3e 0a 23 69 6e | 63 6c 75 64 65 20 3c 73 |m.h>.#in|clude <s|
|000058c0| 79 73 2f 69 6f 63 74 6c | 2e 68 3e 0a 23 69 6e 63 |ys/ioctl|.h>.#inc|
|000058d0| 6c 75 64 65 20 3c 73 79 | 73 2f 73 6f 63 6b 65 74 |lude <sy|s/socket|
|000058e0| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |.h>.#inc|lude <sy|
|000058f0| 73 2f 66 69 6c 65 2e 68 | 3e 0a 23 69 6e 63 6c 75 |s/file.h|>.#inclu|
|00005900| 64 65 20 3c 73 79 73 2f | 74 69 6d 65 2e 68 3e 0a |de <sys/|time.h>.|
|00005910| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 6e 65 74 69 6e |.#includ|e <netin|
|00005920| 65 74 2f 69 6e 2e 68 3e | 0a 0a 23 69 6e 63 6c 75 |et/in.h>|..#inclu|
|00005930| 64 65 20 3c 61 72 70 61 | 2f 69 6e 65 74 2e 68 3e |de <arpa|/inet.h>|
|00005940| 0a 0a 23 69 6e 63 6c 75 | 64 65 20 3c 73 74 64 69 |..#inclu|de <stdi|
|00005950| 6f 2e 68 3e 0a 23 69 6e | 63 6c 75 64 65 20 3c 65 |o.h>.#in|clude <e|
|00005960| 72 72 6e 6f 2e 68 3e 0a | 23 69 6e 63 6c 75 64 65 |rrno.h>.|#include|
|00005970| 20 3c 70 77 64 2e 68 3e | 0a 23 69 6e 63 6c 75 64 | <pwd.h>|.#includ|
|00005980| 65 20 3c 73 69 67 6e 61 | 6c 2e 68 3e 0a 23 69 6e |e <signa|l.h>.#in|
|00005990| 63 6c 75 64 65 20 3c 6e | 65 74 64 62 2e 68 3e 0a |clude <n|etdb.h>.|
|000059a0| 23 69 6e 63 6c 75 64 65 | 20 3c 73 79 73 6c 6f 67 |#include| <syslog|
|000059b0| 2e 68 3e 0a 0a 69 6e 74 | 09 65 72 72 6e 6f 3b 0a |.h>..int|.errno;.|
|000059c0| 69 6e 74 09 6b 65 65 70 | 61 6c 69 76 65 20 3d 20 |int.keep|alive = |
|000059d0| 31 3b 0a 63 68 61 72 09 | 2a 69 6e 64 65 78 28 29 |1;.char.|*index()|
|000059e0| 2c 20 2a 72 69 6e 64 65 | 78 28 29 2c 20 2a 73 74 |, *rinde|x(), *st|
|000059f0| 72 6e 63 61 74 28 29 3b | 0a 2f 2a 56 41 52 41 52 |rncat();|./*VARAR|
|00005a00| 47 53 31 2a 2f 0a 69 6e | 74 09 65 72 72 6f 72 28 |GS1*/.in|t.error(|
|00005a10| 29 3b 0a 0a 2f 2a 41 52 | 47 53 55 53 45 44 2a 2f |);../*AR|GSUSED*/|
|00005a20| 0a 6d 61 69 6e 28 61 72 | 67 63 2c 20 61 72 67 76 |.main(ar|gc, argv|
|00005a30| 29 0a 09 69 6e 74 20 61 | 72 67 63 3b 0a 09 63 68 |)..int a|rgc;..ch|
|00005a40| 61 72 20 2a 2a 61 72 67 | 76 3b 0a 7b 0a 09 65 78 |ar **arg|v;.{..ex|
|00005a50| 74 65 72 6e 20 69 6e 74 | 20 6f 70 74 65 72 72 2c |tern int| opterr,|
|00005a60| 20 6f 70 74 69 6e 64 2c | 20 5f 63 68 65 63 6b 5f | optind,| _check_|
|00005a70| 72 68 6f 73 74 73 5f 66 | 69 6c 65 3b 0a 09 73 74 |rhosts_f|ile;..st|
|00005a80| 72 75 63 74 20 6c 69 6e | 67 65 72 20 6c 69 6e 67 |ruct lin|ger ling|
|00005a90| 65 72 3b 0a 09 69 6e 74 | 20 63 68 2c 20 6f 6e 20 |er;..int| ch, on |
|00005aa0| 3d 20 31 2c 20 66 72 6f | 6d 6c 65 6e 3b 0a 09 73 |= 1, fro|mlen;..s|
|00005ab0| 74 72 75 63 74 20 73 6f | 63 6b 61 64 64 72 5f 69 |truct so|ckaddr_i|
|00005ac0| 6e 20 66 72 6f 6d 3b 0a | 0a 09 6f 70 65 6e 6c 6f |n from;.|..openlo|
|00005ad0| 67 28 22 72 73 68 22 2c | 20 4c 4f 47 5f 50 49 44 |g("rsh",| LOG_PID|
|00005ae0| 20 7c 20 4c 4f 47 5f 4f | 44 45 4c 41 59 2c 20 4c | | LOG_O|DELAY, L|
|00005af0| 4f 47 5f 44 41 45 4d 4f | 4e 29 3b 0a 0a 09 6f 70 |OG_DAEMO|N);...op|
|00005b00| 74 65 72 72 20 3d 20 30 | 3b 0a 09 77 68 69 6c 65 |terr = 0|;..while|
|00005b10| 20 28 28 63 68 20 3d 20 | 67 65 74 6f 70 74 28 61 | ((ch = |getopt(a|
|00005b20| 72 67 63 2c 20 61 72 67 | 76 2c 20 22 6c 6e 22 29 |rgc, arg|v, "ln")|
|00005b30| 29 20 21 3d 20 45 4f 46 | 29 0a 09 09 73 77 69 74 |) != EOF|)...swit|
|00005b40| 63 68 28 28 63 68 61 72 | 29 63 68 29 20 7b 0a 09 |ch((char|)ch) {..|
|00005b50| 09 63 61 73 65 20 27 6c | 27 3a 0a 09 09 09 5f 63 |.case 'l|':...._c|
|00005b60| 68 65 63 6b 5f 72 68 6f | 73 74 73 5f 66 69 6c 65 |heck_rho|sts_file|
|00005b70| 20 3d 20 30 3b 0a 09 09 | 09 62 72 65 61 6b 3b 0a | = 0;...|.break;.|
|00005b80| 09 09 63 61 73 65 20 27 | 6e 27 3a 0a 09 09 09 6b |..case '|n':....k|
|00005b90| 65 65 70 61 6c 69 76 65 | 20 3d 20 30 3b 0a 09 09 |eepalive| = 0;...|
|00005ba0| 09 62 72 65 61 6b 3b 0a | 09 09 63 61 73 65 20 27 |.break;.|..case '|
|00005bb0| 3f 27 3a 0a 09 09 64 65 | 66 61 75 6c 74 3a 0a 09 |?':...de|fault:..|
|00005bc0| 09 09 73 79 73 6c 6f 67 | 28 4c 4f 47 5f 45 52 52 |..syslog|(LOG_ERR|
|00005bd0| 2c 20 22 75 73 61 67 65 | 3a 20 72 73 68 64 20 5b |, "usage|: rshd [|
|00005be0| 2d 6c 5d 22 29 3b 0a 09 | 09 09 62 72 65 61 6b 3b |-l]");..|..break;|
|00005bf0| 0a 09 09 7d 0a 0a 09 61 | 72 67 63 20 2d 3d 20 6f |...}...a|rgc -= o|
|00005c00| 70 74 69 6e 64 3b 0a 09 | 61 72 67 76 20 2b 3d 20 |ptind;..|argv += |
|00005c10| 6f 70 74 69 6e 64 3b 0a | 0a 0a 09 66 72 6f 6d 6c |optind;.|...froml|
|00005c20| 65 6e 20 3d 20 73 69 7a | 65 6f 66 20 28 66 72 6f |en = siz|eof (fro|
|00005c30| 6d 29 3b 0a 09 69 66 20 | 28 67 65 74 70 65 65 72 |m);..if |(getpeer|
|00005c40| 6e 61 6d 65 28 30 2c 20 | 26 66 72 6f 6d 2c 20 26 |name(0, |&from, &|
|00005c50| 66 72 6f 6d 6c 65 6e 29 | 20 3c 20 30 29 20 7b 0a |fromlen)| < 0) {.|
|00005c60| 09 09 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 |..fprint|f(stderr|
|00005c70| 2c 20 22 25 73 3a 20 22 | 2c 20 61 72 67 76 5b 30 |, "%s: "|, argv[0|
|00005c80| 5d 29 3b 0a 09 09 70 65 | 72 72 6f 72 28 22 67 65 |]);...pe|rror("ge|
|00005c90| 74 70 65 65 72 6e 61 6d | 65 22 29 3b 0a 09 09 5f |tpeernam|e");..._|
|00005ca0| 65 78 69 74 28 31 29 3b | 0a 09 7d 0a 09 69 66 20 |exit(1);|..}..if |
|00005cb0| 28 6b 65 65 70 61 6c 69 | 76 65 20 26 26 0a 09 20 |(keepali|ve &&.. |
|00005cc0| 20 20 20 73 65 74 73 6f | 63 6b 6f 70 74 28 30 2c | setso|ckopt(0,|
|00005cd0| 20 53 4f 4c 5f 53 4f 43 | 4b 45 54 2c 20 53 4f 5f | SOL_SOC|KET, SO_|
|00005ce0| 4b 45 45 50 41 4c 49 56 | 45 2c 20 28 63 68 61 72 |KEEPALIV|E, (char|
|00005cf0| 20 2a 29 26 6f 6e 2c 0a | 09 20 20 20 20 73 69 7a | *)&on,.|. siz|
|00005d00| 65 6f 66 28 6f 6e 29 29 | 20 3c 20 30 29 0a 09 09 |eof(on))| < 0)...|
|00005d10| 73 79 73 6c 6f 67 28 4c | 4f 47 5f 57 41 52 4e 49 |syslog(L|OG_WARNI|
|00005d20| 4e 47 2c 20 22 73 65 74 | 73 6f 63 6b 6f 70 74 20 |NG, "set|sockopt |
|00005d30| 28 53 4f 5f 4b 45 45 50 | 41 4c 49 56 45 29 3a 20 |(SO_KEEP|ALIVE): |
|00005d40| 25 6d 22 29 3b 0a 09 6c | 69 6e 67 65 72 2e 6c 5f |%m");..l|inger.l_|
|00005d50| 6f 6e 6f 66 66 20 3d 20 | 31 3b 0a 09 6c 69 6e 67 |onoff = |1;..ling|
|00005d60| 65 72 2e 6c 5f 6c 69 6e | 67 65 72 20 3d 20 36 30 |er.l_lin|ger = 60|
|00005d70| 3b 09 09 09 2f 2a 20 58 | 58 58 20 2a 2f 0a 09 69 |;.../* X|XX */..i|
|00005d80| 66 20 28 73 65 74 73 6f | 63 6b 6f 70 74 28 30 2c |f (setso|ckopt(0,|
|00005d90| 20 53 4f 4c 5f 53 4f 43 | 4b 45 54 2c 20 53 4f 5f | SOL_SOC|KET, SO_|
|00005da0| 4c 49 4e 47 45 52 2c 20 | 28 63 68 61 72 20 2a 29 |LINGER, |(char *)|
|00005db0| 26 6c 69 6e 67 65 72 2c | 0a 09 20 20 20 20 73 69 |&linger,|.. si|
|00005dc0| 7a 65 6f 66 20 28 6c 69 | 6e 67 65 72 29 29 20 3c |zeof (li|nger)) <|
|00005dd0| 20 30 29 0a 09 09 73 79 | 73 6c 6f 67 28 4c 4f 47 | 0)...sy|slog(LOG|
|00005de0| 5f 57 41 52 4e 49 4e 47 | 2c 20 22 73 65 74 73 6f |_WARNING|, "setso|
|00005df0| 63 6b 6f 70 74 20 28 53 | 4f 5f 4c 49 4e 47 45 52 |ckopt (S|O_LINGER|
|00005e00| 29 3a 20 25 6d 22 29 3b | 0a 09 64 6f 69 74 28 26 |): %m");|..doit(&|
|00005e10| 66 72 6f 6d 29 3b 0a 7d | 0a 0a 63 68 61 72 09 75 |from);.}|..char.u|
|00005e20| 73 65 72 6e 61 6d 65 5b | 32 30 5d 20 3d 20 22 55 |sername[|20] = "U|
|00005e30| 53 45 52 3d 22 3b 0a 63 | 68 61 72 09 68 6f 6d 65 |SER=";.c|har.home|
|00005e40| 64 69 72 5b 36 34 5d 20 | 3d 20 22 48 4f 4d 45 3d |dir[64] |= "HOME=|
|00005e50| 22 3b 0a 63 68 61 72 09 | 73 68 65 6c 6c 5b 36 34 |";.char.|shell[64|
|00005e60| 5d 20 3d 20 22 53 48 45 | 4c 4c 3d 22 3b 0a 63 68 |] = "SHE|LL=";.ch|
|00005e70| 61 72 09 2a 65 6e 76 69 | 6e 69 74 5b 5d 20 3d 0a |ar.*envi|nit[] =.|
|00005e80| 09 20 20 20 20 7b 68 6f | 6d 65 64 69 72 2c 20 73 |. {ho|medir, s|
|00005e90| 68 65 6c 6c 2c 20 22 50 | 41 54 48 3d 2f 75 73 72 |hell, "P|ATH=/usr|
|00005ea0| 2f 75 63 62 3a 2f 62 69 | 6e 3a 2f 75 73 72 2f 62 |/ucb:/bi|n:/usr/b|
|00005eb0| 69 6e 3a 22 2c 20 75 73 | 65 72 6e 61 6d 65 2c 20 |in:", us|ername, |
|00005ec0| 30 7d 3b 0a 63 68 61 72 | 09 2a 2a 65 6e 76 69 72 |0};.char|.**envir|
|00005ed0| 6f 6e 3b 0a 0a 64 6f 69 | 74 28 66 72 6f 6d 70 29 |on;..doi|t(fromp)|
|00005ee0| 0a 09 73 74 72 75 63 74 | 20 73 6f 63 6b 61 64 64 |..struct| sockadd|
|00005ef0| 72 5f 69 6e 20 2a 66 72 | 6f 6d 70 3b 0a 7b 0a 09 |r_in *fr|omp;.{..|
|00005f00| 63 68 61 72 20 63 6d 64 | 62 75 66 5b 4e 43 41 52 |char cmd|buf[NCAR|
|00005f10| 47 53 2b 31 5d 2c 20 2a | 63 70 3b 0a 09 63 68 61 |GS+1], *|cp;..cha|
|00005f20| 72 20 6c 6f 63 75 73 65 | 72 5b 31 36 5d 2c 20 72 |r locuse|r[16], r|
|00005f30| 65 6d 75 73 65 72 5b 31 | 36 5d 3b 0a 09 73 74 72 |emuser[1|6];..str|
|00005f40| 75 63 74 20 70 61 73 73 | 77 64 20 2a 70 77 64 3b |uct pass|wd *pwd;|
|00005f50| 0a 09 69 6e 74 20 73 3b | 0a 09 73 74 72 75 63 74 |..int s;|..struct|
|00005f60| 20 68 6f 73 74 65 6e 74 | 20 2a 68 70 3b 0a 09 63 | hostent| *hp;..c|
|00005f70| 68 61 72 20 2a 68 6f 73 | 74 6e 61 6d 65 3b 0a 09 |har *hos|tname;..|
|00005f80| 73 68 6f 72 74 20 70 6f | 72 74 3b 0a 09 69 6e 74 |short po|rt;..int|
|00005f90| 20 70 76 5b 32 5d 2c 20 | 70 69 64 2c 20 63 63 3b | pv[2], |pid, cc;|
|00005fa0| 0a 09 69 6e 74 20 6e 66 | 64 3b 0a 09 66 64 5f 73 |..int nf|d;..fd_s|
|00005fb0| 65 74 20 72 65 61 64 79 | 2c 20 72 65 61 64 66 72 |et ready|, readfr|
|00005fc0| 6f 6d 3b 0a 09 63 68 61 | 72 20 62 75 66 5b 42 55 |om;..cha|r buf[BU|
|00005fd0| 46 53 49 5a 5d 2c 20 73 | 69 67 3b 0a 09 69 6e 74 |FSIZ], s|ig;..int|
|00005fe0| 20 6f 6e 65 20 3d 20 31 | 3b 0a 09 63 68 61 72 20 | one = 1|;..char |
|00005ff0| 72 65 6d 6f 74 65 68 6f | 73 74 5b 32 20 2a 20 4d |remoteho|st[2 * M|
|00006000| 41 58 48 4f 53 54 4e 41 | 4d 45 4c 45 4e 20 2b 20 |AXHOSTNA|MELEN + |
|00006010| 31 5d 3b 0a 0a 09 28 76 | 6f 69 64 29 20 73 69 67 |1];...(v|oid) sig|
|00006020| 6e 61 6c 28 53 49 47 49 | 4e 54 2c 20 53 49 47 5f |nal(SIGI|NT, SIG_|
|00006030| 44 46 4c 29 3b 0a 09 28 | 76 6f 69 64 29 20 73 69 |DFL);..(|void) si|
|00006040| 67 6e 61 6c 28 53 49 47 | 51 55 49 54 2c 20 53 49 |gnal(SIG|QUIT, SI|
|00006050| 47 5f 44 46 4c 29 3b 0a | 09 28 76 6f 69 64 29 20 |G_DFL);.|.(void) |
|00006060| 73 69 67 6e 61 6c 28 53 | 49 47 54 45 52 4d 2c 20 |signal(S|IGTERM, |
|00006070| 53 49 47 5f 44 46 4c 29 | 3b 0a 23 69 66 64 65 66 |SIG_DFL)|;.#ifdef|
|00006080| 20 44 45 42 55 47 0a 09 | 7b 20 69 6e 74 20 74 20 | DEBUG..|{ int t |
|00006090| 3d 20 6f 70 65 6e 28 22 | 2f 64 65 76 2f 74 74 79 |= open("|/dev/tty|
|000060a0| 22 2c 20 32 29 3b 0a 09 | 20 20 69 66 20 28 74 20 |", 2);..| if (t |
|000060b0| 3e 3d 20 30 29 20 7b 0a | 09 09 69 6f 63 74 6c 28 |>= 0) {.|..ioctl(|
|000060c0| 74 2c 20 54 49 4f 43 4e | 4f 54 54 59 2c 20 28 63 |t, TIOCN|OTTY, (c|
|000060d0| 68 61 72 20 2a 29 30 29 | 3b 0a 09 09 28 76 6f 69 |har *)0)|;...(voi|
|000060e0| 64 29 20 63 6c 6f 73 65 | 28 74 29 3b 0a 09 20 20 |d) close|(t);.. |
|000060f0| 7d 0a 09 7d 0a 23 65 6e | 64 69 66 0a 09 66 72 6f |}..}.#en|dif..fro|
|00006100| 6d 70 2d 3e 73 69 6e 5f | 70 6f 72 74 20 3d 20 6e |mp->sin_|port = n|
|00006110| 74 6f 68 73 28 28 75 5f | 73 68 6f 72 74 29 66 72 |tohs((u_|short)fr|
|00006120| 6f 6d 70 2d 3e 73 69 6e | 5f 70 6f 72 74 29 3b 0a |omp->sin|_port);.|
|00006130| 09 69 66 20 28 66 72 6f | 6d 70 2d 3e 73 69 6e 5f |.if (fro|mp->sin_|
|00006140| 66 61 6d 69 6c 79 20 21 | 3d 20 41 46 5f 49 4e 45 |family !|= AF_INE|
|00006150| 54 29 20 7b 0a 09 09 73 | 79 73 6c 6f 67 28 4c 4f |T) {...s|yslog(LO|
|00006160| 47 5f 45 52 52 2c 20 22 | 6d 61 6c 66 6f 72 6d 65 |G_ERR, "|malforme|
|00006170| 64 20 66 72 6f 6d 20 61 | 64 64 72 65 73 73 5c 6e |d from a|ddress\n|
|00006180| 22 29 3b 0a 09 09 65 78 | 69 74 28 31 29 3b 0a 09 |");...ex|it(1);..|
|00006190| 7d 0a 23 69 66 64 65 66 | 20 49 50 5f 4f 50 54 49 |}.#ifdef| IP_OPTI|
|000061a0| 4f 4e 53 0a 20 20 20 20 | 20 20 7b 0a 09 75 5f 63 |ONS. | {..u_c|
|000061b0| 68 61 72 20 6f 70 74 62 | 75 66 5b 42 55 46 53 49 |har optb|uf[BUFSI|
|000061c0| 5a 2f 33 5d 2c 20 2a 63 | 70 3b 0a 09 63 68 61 72 |Z/3], *c|p;..char|
|000061d0| 20 6c 62 75 66 5b 42 55 | 46 53 49 5a 5d 2c 20 2a | lbuf[BU|FSIZ], *|
|000061e0| 6c 70 3b 0a 09 69 6e 74 | 20 6f 70 74 73 69 7a 65 |lp;..int| optsize|
|000061f0| 20 3d 20 73 69 7a 65 6f | 66 28 6f 70 74 62 75 66 | = sizeo|f(optbuf|
|00006200| 29 2c 20 69 70 70 72 6f | 74 6f 3b 0a 09 73 74 72 |), ippro|to;..str|
|00006210| 75 63 74 20 70 72 6f 74 | 6f 65 6e 74 20 2a 69 70 |uct prot|oent *ip|
|00006220| 3b 0a 0a 09 69 66 20 28 | 28 69 70 20 3d 20 67 65 |;...if (|(ip = ge|
|00006230| 74 70 72 6f 74 6f 62 79 | 6e 61 6d 65 28 22 69 70 |tprotoby|name("ip|
|00006240| 22 29 29 20 21 3d 20 4e | 55 4c 4c 29 0a 09 09 69 |")) != N|ULL)...i|
|00006250| 70 70 72 6f 74 6f 20 3d | 20 69 70 2d 3e 70 5f 70 |pproto =| ip->p_p|
|00006260| 72 6f 74 6f 3b 0a 09 65 | 6c 73 65 0a 09 09 69 70 |roto;..e|lse...ip|
|00006270| 70 72 6f 74 6f 20 3d 20 | 49 50 50 52 4f 54 4f 5f |proto = |IPPROTO_|
|00006280| 49 50 3b 0a 09 69 66 20 | 28 67 65 74 73 6f 63 6b |IP;..if |(getsock|
|00006290| 6f 70 74 28 30 2c 20 69 | 70 70 72 6f 74 6f 2c 20 |opt(0, i|pproto, |
|000062a0| 49 50 5f 4f 50 54 49 4f | 4e 53 2c 20 28 63 68 61 |IP_OPTIO|NS, (cha|
|000062b0| 72 20 2a 29 6f 70 74 62 | 75 66 2c 20 26 6f 70 74 |r *)optb|uf, &opt|
|000062c0| 73 69 7a 65 29 20 3d 3d | 20 30 20 26 26 0a 09 20 |size) ==| 0 &&.. |
|000062d0| 20 20 20 6f 70 74 73 69 | 7a 65 20 21 3d 20 30 29 | optsi|ze != 0)|
|000062e0| 20 7b 0a 09 09 6c 70 20 | 3d 20 6c 62 75 66 3b 0a | {...lp |= lbuf;.|
|000062f0| 09 09 66 6f 72 20 28 63 | 70 20 3d 20 6f 70 74 62 |..for (c|p = optb|
|00006300| 75 66 3b 20 6f 70 74 73 | 69 7a 65 20 3e 20 30 3b |uf; opts|ize > 0;|
|00006310| 20 63 70 2b 2b 2c 20 6f | 70 74 73 69 7a 65 2d 2d | cp++, o|ptsize--|
|00006320| 2c 20 6c 70 20 2b 3d 20 | 33 29 0a 09 09 09 73 70 |, lp += |3)....sp|
|00006330| 72 69 6e 74 66 28 6c 70 | 2c 20 22 20 25 32 2e 32 |rintf(lp|, " %2.2|
|00006340| 78 22 2c 20 2a 63 70 29 | 3b 0a 09 09 73 79 73 6c |x", *cp)|;...sysl|
|00006350| 6f 67 28 4c 4f 47 5f 4e | 4f 54 49 43 45 2c 0a 09 |og(LOG_N|OTICE,..|
|00006360| 09 20 20 20 20 22 43 6f | 6e 6e 65 63 74 69 6f 6e |. "Co|nnection|
|00006370| 20 72 65 63 65 69 76 65 | 64 20 75 73 69 6e 67 20 | receive|d using |
|00006380| 49 50 20 6f 70 74 69 6f | 6e 73 20 28 69 67 6e 6f |IP optio|ns (igno|
|00006390| 72 65 64 29 3a 25 73 22 | 2c 20 6c 62 75 66 29 3b |red):%s"|, lbuf);|
|000063a0| 0a 09 09 69 66 20 28 73 | 65 74 73 6f 63 6b 6f 70 |...if (s|etsockop|
|000063b0| 74 28 30 2c 20 69 70 70 | 72 6f 74 6f 2c 20 49 50 |t(0, ipp|roto, IP|
|000063c0| 5f 4f 50 54 49 4f 4e 53 | 2c 0a 09 09 20 20 20 20 |_OPTIONS|,... |
|000063d0| 28 63 68 61 72 20 2a 29 | 4e 55 4c 4c 2c 20 26 6f |(char *)|NULL, &o|
|000063e0| 70 74 73 69 7a 65 29 20 | 21 3d 20 30 29 20 7b 0a |ptsize) |!= 0) {.|
|000063f0| 09 09 09 73 79 73 6c 6f | 67 28 4c 4f 47 5f 45 52 |...syslo|g(LOG_ER|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.